Jump to content

Deleting RGB data in a transparent area


Recommended Posts

Hi,

I've looked around, but can't find the answer to this, although I've found a lot of conversations on alpha layers so I imagine it's been asked before..but I haven't read it...

If I have an image which has an area that is fully transparent, there still appears to be an image in the transparent area, but it just isn't visible. i.e. If I open a .png file into mspaint, the transparent areas suddenly show elements of the image that I wish to remove completely for various reasons.

Firstly is there a way of deleting any rgb data for a pixel if the opacity is 0%? (not literally delete, but just make them all 0 or 255, so in effect blank)

Secondly, surely if there is an image in areas you don't see this makes images larger in file size than necessary? (for png's for example)

Thanks,

Ben

Link to comment
Share on other sites

If it is truly 100% transparent, it should not be happening. Unless you are working with multiple errors, and you are flattening them, you will have problems with the transparency.I would try this tool, instead of adjusting transparency in the Layer Properties. You shouldnt run into this problem again.

http://paintdotnet.forumer.com/viewtopic.php?t=3285

signature.png

Link to comment
Share on other sites

Nope, sorry, unless you have a full border of transparent pixels that you can crop out. Most image formats support rectangular images only. I think GIMP's and Photoshop's formats support non-rectangular layers, but they might require at least 1 layer to be the full size of the image. I don't know; I haven't used either of them for a long time.

If you're saving in PNG, and you have pixels with alpha of 0, make sure that the RGB values of every alpha:0 pixel is is also 0, and that might help shrink your filesize quite a bit, especially if using a PNG compressor such as Opti-PNG or PNGOUT.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

No, he's requesting that the image be shrunk to eliminate even transparent pixels.

I'm sorry, I'm unaware of any image file (PSD included) that will save an irregular shape.

As a side note, take a look at the rules. Try to steer clear of "Help" in your thread titles. We know that's why you're here, or you wouldn't have posted. :-) Adding "Help" is redundant and clutters up the forum. I deleted it for you, but keep that in mind for the future.

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

I must have not understood what you are asking for. You are asking for complete transparency in a layer, right?

No, he wants to know if there is a way that transparent pixels in an image, instead of still taking up space in the saved file, can simply be omitted from the saved file to decrease the filesize.

I'm sorry, I'm unaware of any image file (PSD included) that will save an irregular shape.

Quite true, but depending on the way that Photoshop or GIMP actually implements their saving, if an image only contains a single irregularly-shaped layer, it might not store any data at all for the parts that "aren't there." Not sure though...

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

The GIMP supports layers that have sizes different from the overall canvas size (larger or smaller), but any irregularly-shaped layer cropping results in the smallest possible rectangular layer to contain all layer content.

I've heard that Photoshop supports non-rectangular pixels, but I've had no experience with this feature.

Still, as far as I know there's no way to completely remove all RGB information from transparent pixels in most* flat-image formats.

If you could post a screenshot of the error as it occurs in Paint, we may be able to figure out a way around it.

* I say "most" because it may be possible in some format or another. I'm just not aware of any.

I am not a mechanism, I am part of the resistance;

I am an organism, an animal, a creature, I am a beast.

~ Becoming the Archetype

Link to comment
Share on other sites

The speed of these replies is crazy, thanks a lot. I obviously didn't make it clear enough what I meant, sorry about that..i tried! I have made an image, because I'm not particularly good at describing things! Sorry about sticking 'help' in the title, I just assumed I should be specific in the general area.

I'm not always entirely clear why, or when, I end up with a lot of invisible rubbish...but I have a lot of sprites that I am trying to keep as small as possible and also there are elements that I wish to remove for various reasons. But in opening them into MSpaint I noticed that there is all this clutter, but there is no easy way that I can see of removing it. (in the example attached it would be easy as its 100% and 0% opaque, but usually this isn't so)

In the example I have the file opened to paint.net, then it opened to MSpaint, and then how I wish to open it in MSpaint and see it.

Pyrochild: Your answer in explaining what I meant is basically correct. I'm not specifically trying to remove the transparent pixels entirely, but rather just blank them. I have no idea how the file saving works, but if there is a colour that is default and therefore doesn't need stating then to make it that colour would be good.

cheers,

840_33eb1118d283f9bed482b367f9f0bcd6

Ben

Link to comment
Share on other sites

That's the reason you need a plugin such as OptiPNG. It's available in the Plugins forum now.

 

The Doctor: There was a goblin, or a trickster, or a warrior... A nameless, terrible thing, soaked in the blood of a billion galaxies. The most feared being in all the cosmos. And nothing could stop it, or hold it, or reason with it. One day it would just drop out of the sky and tear down your world.
Amy: But how did it end up in there?
The Doctor: You know fairy tales. A good wizard tricked it.
River Song: I hate good wizards in fairy tales; they always turn out to be him.

Link to comment
Share on other sites

Bingo, that doesn't exactly what I needed. Thank you very much for that link, and thanks to "I Like Pi" for making that plug-in!

Just tested a few images, and it removes the rubbish fine. I'm still not entirely clear how I got them how they are, as I made them quite some time ago, but this allows them to be quickly sorted, so that no longer really matters.

bye!

Ben

Link to comment
Share on other sites

It seems like you've used the Alpha Mask plugin to remove a shape. With the Alpha Mask (and BB's Transparency plugin), it just sets the Alpha bits to 00, leaving the RRGGBB values the same. MS Paint is ignoring the transparency information and so it's displaying the color that's hidden in Paint.NET.

Using the OptiPNG plugin as Dave suggested in RGB-Only mode would remove the transparency from the image. You'd get the proper MS Paint result, but you'd completely lose transparency in the image. This basically functions the same as adding a new layer, moving down so it's the last layer of the image, filling it with white, and saving the image.

I'm still trying to come up with a reliable way to remove the color based upon the Alpha. I thought that pyro's Curves + plugin might be able to help, but I've been unable to find the necessary settings. Using the Delete key on a Selection sets the Alpha to 00 and the background color to FFFFFF (white, as you desire), but doing so would remove any anti-aliasing in the final image.

I'll try and wrap my head around something, and I'll let you know when I find it. In the mean time, perhaps another user will come along and point out that something I'm missing. :wink:

Best of luck!

I am not a mechanism, I am part of the resistance;

I am an organism, an animal, a creature, I am a beast.

~ Becoming the Archetype

Link to comment
Share on other sites

Crazy Man Dan: I used the optiPNG plugin with the alpha turned on, which was slightly bigger, but I need the alpha if possible. Using the Curves+ plug-in is a helpful way to get rid of the 0-5% opaque areas, which are just there as a result of clumsiness, and aren't needed at all.

BoltBait's Transparency plug-in does similar by sticking down the transparency, and then duplicating the layer. (resulting in the low opacity areas being dropped).

Using a mix of these suggested tools does result in the images down to 25% of the file size though which is great, and the images are bearable in a browser not displaying the alpha layer. I have got some test files as I wanted, but it takes a few more clicks than I hoped for. By v4.0 hopefully it can be stuck as an action (I forget the name used for paint.nets proposal), and that will make the complexity of getting an effect repeatedly hardly an issue once you have got it once.

Thanks for all the links to things. Once you read them it seems obvious, but I find, until you know what your looking for, it's sometimes hard to search for it!

Ben

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...