Page 1 of 2

Editing an images loses its transparency

Posted: Mon Jan 14, 2013 11:03 pm
by Brother Gabriel-Marie
This is a bug that's been in XnView for years.

If I have a png or gif with a transparent background and edit the image in XnView, either by changing its color mode or anything else, when it is saved, the transparent background is changed to white.

The problem persists in version 1.996

Re: Editing an images loses its transparency

Posted: Tue Jan 15, 2013 2:03 pm
by xnview
Do you changed from color in RGBA?

Re: Editing an images loses its transparency

Posted: Tue Jan 15, 2013 2:58 pm
by Brother Gabriel-Marie
Hi, Mr. XnView. If I change from color RGB to greyscale, the transparent background turns to white. The thumbnail also loses the transparency.

I can confirm this because it is even white when I open the files in Photoshop. I had the same problem on my old XP as I do now in Windows 7 x64.

Re: Editing an images loses its transparency

Posted: Wed Jan 16, 2013 6:55 am
by xnview
8bits picture has no transparency mask in Xnview

Re: Editing an images loses its transparency

Posted: Thu Jan 17, 2013 9:30 pm
by XnTriq
Workaround:
  • Download logo.png (32-bit RGBA) and open it in XnView MP.
  • Go to Image » Change color depth... and select 24 bits » OK.
  • Go to Image » Change color depth... again and select Greyscale [256] » OK.
  • Save the result as greyscale.png.
  • Open logo.png once more and go to Image » Extract channel » Alpha.
  • Save the result as mask.png.
  • Go to Tools » Batch convert... and specify the following settings:
    • Input
      • greyscale.png
    • Actions
      • Image » Add mask
        • Mask: [mask.png]
        • [√] Use mask as alpha
    • Output
      • Format: [PNG]
greyscale_result.png is a achromatic/desaturated/grayish version of logo.png.
  • Image Image Image Image
    Left to right: logo.png + greyscale.png + mask.png + greyscale_result.png

Re: Editing an images loses its transparency

Posted: Sun Jan 20, 2013 4:08 am
by Brother Gabriel-Marie
8bits picture has no transparency mask in Xnview
I'm a little confused - so when I change a RGB file to Greyscale in XnView, then is it supposed to lose its transparency? I don't want it to do that. I am forced to open the file in Photoshop to change the colours. I don't want to do that either.

And it's not just the masking for the thumbnail. If I change it to greyscale, the transparency is completely lost - I can see it lost when I edit it in Photoshop. I have to edit the file again in order to fix it.

Also, an 8bit image with transparency does not display its transparency in XnView in "View" mode, although it *does* in thumbnail mode.

It is the same problem either with an 8 bit image OR a 16bit image.

If the thumbnail does not show its transparency, which it doesn't at first, it *will* if you a "rebuild thumbnail" on the file (or files in the folder).

In my (humble) opinion, whether 8bit OR 16bit, if I change the colour from rgb to greyscale, the transparency should be preserved, AND the thumbnail should be automatically rebuilt.

Image

Re: Editing an images loses its transparency

Posted: Sun Jan 20, 2013 7:00 am
by XnTriq
Brother Gabriel-Marie wrote:Also, an 8bit image with transparency does not display its transparency in XnView in "View" mode, although it *does* in thumbnail mode.
This is a known limitation. It was fixed in XnView v1.97 for 8-bit color PNGs + alpha-channel transparency, but the issue persists with grayscale + alpha channel.

Re: Editing an images loses its transparency

Posted: Sun Jan 20, 2013 2:51 pm
by Brother Gabriel-Marie
@XnTriq, thanks for the confirmation (I *knew* I wasn't crazy), and the for the info (and for fixing my image-link).

Re: Editing an images loses its transparency

Posted: Tue Dec 10, 2013 10:47 pm
by Brother Gabriel-Marie
I use XnView to view png files all the time. Sometimes the png files will show the transparency in the thumbnail, sometimes they don't. Most of the time they don't show the transparency in preview mode. And this happens even if I don't edit them in XnView.

I am having this problem with png files made by exporting from Adobe Illustrator CS5 (Windows 7 Pro x64; 16gb RAM; XnView 2.10)

If I rebuild thumbnails, the transparency seems to get fixed on the thumbnails, but I have to do it over and over to the same images. And that doesn't help the preview.

Is there some setting somewhere to make the transparency rendering consistent?

Re: Editing an images loses its transparency

Posted: Tue Dec 16, 2014 4:19 am
by Brother Gabriel-Marie
Hi folks! I'm back to this again; hoping circumstances are okay now to get a fix.
Version 2.25

So I have some png files with transparent backgrounds.
24 bit RGB

When I adjust the gamma/contrast of the image and save it in xnview, all the transparency is turned to white.
This problem is in the image file itself - not just the preview.

Re: Editing an images loses its transparency

Posted: Tue Dec 16, 2014 5:00 pm
by XnTriq
Brother Gabriel-Marie wrote:So I have some png files with transparent backgrounds.
24 bit RGB

When I adjust the gamma/contrast of the image and save it in xnview, all the transparency is turned to white.
This problem is in the image file itself - not just the preview.
Could you post a sample, Br. Gabriel-Marie?

Re: Editing an images loses its transparency

Posted: Tue Dec 16, 2014 5:31 pm
by Brother Gabriel-Marie
Ak! I tried to upload my sample files, but the forum says
"Image file type mismatch: expected extension jpg but extension png given" - I've had that before. PITA.
If I upload them to imgur, the transparency gets scrapped there, too.
Maybe I could email them to you...

But this is an example of sorts:
screenshot_XnView (XnView for Windows) [xnview]_009.png
screenshot_XnView (XnView for Windows) [xnview]_009.png (22.35 KiB) Viewed 3663 times

Re: Editing an images loses its transparency

Posted: Tue Dec 16, 2014 5:36 pm
by cday
Brother Gabriel-Marie wrote:Ak! I tried to upload my sample files, but the forum says
"Image file type mismatch: expected extension jpg but extension png given" - I've had that before. PITA.
Might upload successfully in a ZIP (or RAR) archive?

Re: Editing an images loses its transparency

Posted: Tue Dec 16, 2014 5:46 pm
by Brother Gabriel-Marie
Okay, I had to use different images.
Here is a zip file.

Re: Editing an images loses its transparency

Posted: Wed Dec 17, 2014 3:30 am
by XnTriq
I can't reproduce :?

What I done did:
  1. Fired up XnView v2.25
  2. Opened opossum.png
  3. Went to Image » Adjust » Brightness/Contrast/Gamma/Balance...
  4. Set Contrast to 127
  5. Set Gamma correction to 0.50
    1. Went to File » Export... » PNG to save opossum.png as opossum_export.png
    2. Went to File » Save to overwrite opossum.png
The alpha channel transparency of the resulting files (opossum_export.png + overwritten opossum.png) is left intact and both files are bit-for-bit identical.

Code: Select all

X:\>FC /B opossum.png opossum_export.png
Comparing files opossum.png and opossum_export.png
FC: no differences encountered
What are your settings in Tools » Options... » Read/Write » Write » PNG » Parameters, Br. Gabriel-Marie?