Gimp-Forum.net

Full Version: save color values from transparent pixels
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
When exporting to png there is an option to save color values from transparent pixels.  It is not the default.  I am still a newbie with transparent pixels.

I am tracing objects with the intent of later adding them to another image.  First I trace with free select and then I copy and paste the object to a transparent layer.  Then I export to a png and I get the option to save color values from transparent pixels.  I don't know whether or not to select this option.

When I zoom in on the pasted object on the transparent layer I see along the edge of the tracing what appears to be partially transparent pixels.  If I opt to save color values from transparent pixels will the object blend better when I add the png file to another image?
(08-31-2022, 05:03 PM)zeuspaul Wrote: [ -> ]When exporting to png there is an option to save color values from transparent pixels.  It is not the default.  I am still a newbie with transparent pixels.

I am tracing objects with the intent of later adding them to another image.  First I trace with free select and then I copy and paste the object to a transparent layer.  Then I export to a png and I get the option to save color values from transparent pixels.  I don't know whether or not to select this option.

When I zoom in on the pasted object on the transparent layer I see along the edge of the tracing what appears to be partially transparent pixels.  If I opt to save color values from transparent pixels will the object blend better when I add the png file to another image?

The way you do it, no.... The transparent layer you copy/paste to is already filled with black (0,0,0) so that's what the pixels you don't change (so, the ones that remain transparent) are set to.And if you don't save the color of transparent pixels, it is set to black. So whatever your choice, the result is the same.

Of course the colors of all other pixels (including the partially transparent ones) is always saved.
There is some kind of  difference between the two png files.  I have been making an exported file of each until I understand what is going on.  I have opened both in a new image each on a separate layer.  Then I toggle between the two layers.  When I zoom in on an edge there is a difference. The png with the color values saved is about a pixel larger than the other. I don't see any pixels that have been converted to black. This only happens with the pngs which open with the checkerboard pattern.  The option isn't there with jpgs.  If I export to jpg all transparent pixels are converted to the background color.

I don't understand.  The transparent layer is filled with black?  The transparent layer I copy to doesn't look black?  It has the look of a checkerboard. And when I open the png it still has the checkerboard.
Quote:I don't understand.  The transparent layer is filled with black?  The transparent layer I copy to doesn't look black? 

Transparency (alpha channel) is just a mask where White = full opacity and Black = full transparency (greys = degrees of transparency)

Go to Layer -> Mask -> Add Layer Mask and use Transfer layers alpha channel which will show the mask.

Quote:It has the look of a checkerboard. And when I open the png it still has the checkerboard.

It is only a representation, various programs might use different or nothing at all. You can change the representation in Edit -> Preferences -> Interface -> Display. Different checker / solid colour.

[attachment=8604]
I experimented with free select to see how the transparent pixels are created.  It seems like the transparency is pro rated depending on where the free select line passes through the pixel.  In the attached top image I have highlighted the free select line in red.  The lower image is the top image copied and pasted to a transparent layer.  Each vertical row designated by a different color is one pixel.

[attachment=8627]
Yes, this is anti-aliasing in effect, AFAIK.
The actual effect:

These two images are have been saved one with the "Save color of transparent pixels" option, and one without. If you explore them
 with the Pointer dialog,  you will see that for the one saved without the option, the fully transparent pixels are R=G=B=0 (all other have a red component, even where their opacity is very low), while for the other all pixels have kept a red component, even the completely transparent ones.

[attachment=8628][attachment=8629]

PS: Hmmm There is possibly a bug there when saving high precision images. Will investigate later.
Now I see no difference between exporting with or without saving color values.  I exported the image in my previous post once with saving color values and one without.  Then opened both in a new image and toggled between the two.  I see no difference.

In the attached image the top one represents either the one with saving the color values or the one without.  They are the same.

The lower image illustrates how I got confused.  The lower image is both images on at the same time.  Due to transparency of the partially transparent pixels there seems to be a summation of the pixels from both images.

[attachment=8632]
Good call Ofnuts. I turned off anti-aliasing in free select and the semi transparent pixels along the outer edge disappeared (attached image).

So now the question becomes do I want anti-aliasing on or off?  It seems to me an outer row of semi transparent pixels would be a good thing if I want to better blend in a traced image into another image.


[attachment=8633]
Normally you keep the anti-aliasing...