Page 1 of 1

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

Posted: Wed Feb 28, 2007 2:51 am
by SharkD
When cropping a 32-bit PNG image, the result is a 24-bit image with the transparency data merged.

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

Posted: Wed Feb 28, 2007 10:47 am
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?

Posted: Wed Feb 28, 2007 9:31 pm
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

32 BPP still here

Posted: Wed Feb 28, 2007 10:57 pm
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

Posted: Thu Mar 01, 2007 3:08 am
by SharkD
THen maybe there is something wrong with my Xnview installation. I will try reinstalling, this time into a fresh directory.

Posted: Thu Mar 01, 2007 3:51 am
by SharkD
I reinstalled from scratch and the problem seems to have gone away. Thank you and sorry for the trouble!

Posted: Thu Mar 01, 2007 3:36 pm
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).

Posted: Fri Mar 02, 2007 2:16 am
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.

Posted: Fri Mar 02, 2007 12:45 pm
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...

Posted: Sat Mar 03, 2007 1:25 am
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.

Posted: Sat Mar 03, 2007 11:53 pm
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?

Posted: Sun Mar 04, 2007 2:09 am
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.....

Posted: Wed Mar 07, 2007 7:29 pm
by SharkD
Try compressing the image using a program called PNGCRUSH and then see what the filesizes are.

Posted: Wed Mar 07, 2007 11:46 pm
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.