PNG transparency not preserved after conversion

XnConvert Multi Platform - Windows, MacOSX, Linux
Post Reply
ophi
Posts: 3
Joined: Sun Feb 22, 2015 10:57 pm

PNG transparency not preserved after conversion

Post by ophi »

I mostly do batch scaling using lanczos, but it fails with any filter anyway.
It used to work as expected during months (years?) but I am now seeing an increasing amount of .PNG files that are converted with the transparency replaced by a white background. I attached sample files that cannot be scaled while preserving transparency.
Hope you can dig something. Thanks!
Attachments
3.png
3.png (1.24 KiB) Viewed 3621 times
1.png
1.png (1.24 KiB) Viewed 3621 times
2.png
2.png (1.2 KiB) Viewed 3621 times
User avatar
XnTriq
Moderator & Librarian
Posts: 5616
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: PNG transparency not preserved after conversion

Post by XnTriq »

Prior to rescaling 8-bit (indexed/paletted) PNGs with alpha-channel transparency (1.png + 3.png), you need to increase the color depth to 32 bits. Grayscale PNGs with alpha-channel transparency (2.png) are currently not supported by XnView.
ophi
Posts: 3
Joined: Sun Feb 22, 2015 10:57 pm

Re: PNG transparency not preserved after conversion

Post by ophi »

Thank you for the quick reply, but just to be clear, this cannot be done with XnView right?
because actually adding an action such as "modify color depth" => "32bits" does not change anything. (not talking about the "grayscale" one)

edit: I don't want to be rude or anything, but those links in the forum you refer to through google are pretty outdated (2007, 2009..) and I would have thought that such a widespread file format as .PNG would have had more support in XnView (5 years later). Works in GIMP, but GIMP is a pain.
User avatar
XnTriq
Moderator & Librarian
Posts: 5616
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: PNG transparency not preserved after conversion

Post by XnTriq »

ophi wrote:Thank you for the quick reply, but just to be clear, this cannot be done with XnView right?
because actually adding an action such as "modify color depth" => "32bits" does not change anything. (not talking about the "grayscale" one)
  • XnView Classic v2.25
    • It turns out that the 32 bits command is available in the Image menu of view mode but not in Tools » Batch Processing... » Transformations » Convert.
    XnConvert v1.66
    • It is possible to convert images to RGBA via Actions » Add Action > » Image » Change color depth » 32 bits, but this seems to be the equivalent of XnView Classic's Add alpha command.
To answer your question: It can be done manually, but not in batch. :-|
ophi wrote:I would have thought that such a widespread file format as .PNG would have had more support in XnView (5 years later).
Let me put it like this: You won't find anyone on this forum who would be more pleased about a fix than moi.
XnTriq ([url=http://newsgroup.xnview.com/viewtopic.php?t=27522&p=109443#p109443]Editing an images loses its transparency[/url]) wrote:
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.
ophi
Posts: 3
Joined: Sun Feb 22, 2015 10:57 pm

Re: PNG transparency not preserved after conversion

Post by ophi »

Ok thanks for the clarification. BTW I apologize for my previous posts where I am talking about XnView when actually I only use XnConvert. I have been a long time lover of XnConvert, so
You won't find anyone on this forum who would be more pleased about a fix than moi.
Add me to the list ^^
It's no news that PNG is used everywhere on internet, and with the growing adoption of tools such as tinypng.com and other great compressors, we are facing more and more palette reduced PNG files. Hopefully it's not a limitation forever.
Meanwhile I guess I'll write some program to batch convert my PNG files to 32bits color depth before XnConverting them.
Thanks again.
User avatar
XnTriq
Moderator & Librarian
Posts: 5616
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: PNG transparency not preserved after conversion

Post by XnTriq »

ophi wrote:BTW I apologize for my previous posts where I am talking about XnView when actually I only use XnConvert.
Topic has been moved from “XnView Classic”/“Bug Reports” to “XnView MP”/”XnConvert”
ophi wrote:It's no news that PNG is used everywhere on internet, and with the growing adoption of tools such as tinypng.com and other great compressors, we are facing more and more palette reduced PNG files.
My thoughts exactly.
FYI: Color reduction with libimagequant was introduced XnView v1.30 and will also be available in MP v0.75.
ophi wrote:Hopefully it's not a limitation forever.
As you probably know, XnViewMP and XnConvert are based on the Qt framework. I was hoping that these problematic functions could somehow be delegated to Qt (similar to SVG support).
Post Reply