[solved] Cropping 32-bit PNG image results in a 24-bit image

Bugs found in XnView Classic. Please report only one bug per topic!

Moderators: helmut, XnTriq, xnview

Post Reply
SharkD
Posts: 38
Joined: Sun Jul 30, 2006 6:57 am

[solved] Cropping 32-bit PNG image results in a 24-bit image

Post by SharkD »

When cropping a 32-bit PNG image, the result is a 24-bit image with the transparency data merged.
Last edited by SharkD on Fri Mar 02, 2007 10:34 pm, edited 1 time in total.
User avatar
xnview
Author of XnView
Posts: 46252
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Cropping 32-bit PNG image results in a 24-bit image

Post by xnview »

SharkD wrote:When cropping a 32-bit PNG image, the result is a 24-bit image with the transparency data merged.
Are you sure that you have loaded the 32bits PNG as 32bits??? And not in 24bits? You use crop in view mode?
Pierre.
SharkD
Posts: 38
Joined: Sun Jul 30, 2006 6:57 am

Post by SharkD »

Yes, I am sure. I am using crop in the View mode.

Here is a test image. You can tell that it is 32-bits because it blends neatly with the page background.

Image
User avatar
Clo
XnThusiast
Posts: 4441
Joined: Sun Oct 17, 2004 4:57 am
Location: Bordeaux, France
Contact:

32 BPP still here

Post by Clo »

—> SharkD

:) Hello !

• I tested with your image, and I cannot confirm.

• The cropped image is saved as 32 BPP, and it's announced as is, as well in XnView as in all other softs I tried for checking…
- The Alpha channel is saved too, the transparency is kept alright !

- A copy of the cropped image changed as 24 BPP turns to black BG, and its size is reduced by ~40% !

:mrgreen: KR
Claude
Clo
Old user ON SELECTIVE STRIKE till further notice
SharkD
Posts: 38
Joined: Sun Jul 30, 2006 6:57 am

Post by SharkD »

THen maybe there is something wrong with my Xnview installation. I will try reinstalling, this time into a fresh directory.
SharkD
Posts: 38
Joined: Sun Jul 30, 2006 6:57 am

Post by SharkD »

I reinstalled from scratch and the problem seems to have gone away. Thank you and sorry for the trouble!
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Post by Drahken »

I can't get the test image to display properly in xnview. If I have tools->options->read/write->png->compose with alpha checked, I get a white background. If it's unchecked, I get a black one. My application background is grey, and therefore the transparent parts of the image should also be grey. Checking/unchecking the compose with transparency option has no effect (regardless whether or not the alpha option is also checked).
SharkD
Posts: 38
Joined: Sun Jul 30, 2006 6:57 am

Post by SharkD »

"Compose with transparency" is for 8-bit images, so it should rightly not have any effect upon a 32-bit image.

Try disabling both those options and enabling the "Use transparent index (<= 8bits) or alpha channel" option, instead. The image should then render smoothly on top of your application background.

Personally I think both the PNG-specific options should be deprecated.
User avatar
xnview
Author of XnView
Posts: 46252
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Post by xnview »

SharkD wrote:Personally I think both the PNG-specific options should be deprecated.
Yes, you're right. I think that i must add global setting like that, or perhaps a process to use in batch convert...
Pierre.
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Post by Drahken »

The "Use transparent index (<= 8bits) or alpha channel" option was already checked, and toggling it on or off has no effect. I have tried all combinations of having those 3 options toggled on/off, and always gt either the black or white backgrounds. The image displays proper transparency when viewed in other programs, so I'm certain it's not a problem with the image itself.
SharkD
Posts: 38
Joined: Sun Jul 30, 2006 6:57 am

Post by SharkD »

I had the same problem. Reinstalling the program to a fresh directory solved it for me.

Note that simply toggling the options on/off will not always update the image right away. Sometimes you have to switch to another image and then switch back before the changes take affect.

Do you have the "Auto image size" option set to "no fit"? This has caused problems for me.
What does the image look like in the Preview tab of the file browser?
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Post by Drahken »

1) The image never updates simply because you change an option. After changing an option, I open the image again in a new tab.
2) I almost never have imaging progs set to fit anything, scrolling an image is less annoying than always having to zoom out.
3) I never use browser mode.



I remember discussing this issue here with some other image/s before, I don't think anything ever became of it. It's not a big deal anyway, since I almost never deal with alpha trans PNGs. They're a great concept, but the filesizes are insane. It's really be good if the JNG format would catch on so that we could have alpha trans with a more reasonable filesize, but until then.....
SharkD
Posts: 38
Joined: Sun Jul 30, 2006 6:57 am

Post by SharkD »

Try compressing the image using a program called PNGCRUSH and then see what the filesizes are.
User avatar
Drahken
Posts: 884
Joined: Sun Apr 10, 2005 4:29 pm

Post by Drahken »

Pngcrush and similar programs can greatly reduce the size of a PNG image, but 32bit PNGs are still unreasonably large, there is simply no way around this as long as PNGs are lossless (the JNG format allows lossy compression). Take a truecolor PNG and compare it to either an 8bit PNG or a JPG (depending on the content of the image), and you'll find that the JPG/8bit PNG is extremely smaller than even pngcrush can make the truecolor PNG, even though the visual quality remains very similar.
Post Reply