Incorrect display of 16-bit raw PNM

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

Moderators: XnTriq, helmut, xnview

Post Reply
cosmin
Posts: 4
Joined: Mon Nov 03, 2008 1:56 am
Location: Toronto

Incorrect display of 16-bit raw PNM

Post by cosmin »

Hi,

I noticed that the raw PNM formats (both PGM "P5" and PPM "P6") that have MAXVAL=65535 are displayed incorrectly. I believe you somehow get the endianness wrong, because I'm seeing the least-significant 8 bits from the 16-bit image.

If MAXVAL is anything less than 65535, or if the format is text ("P2" or "P3"), everything works fine.

The problem exists both in XnView and NConvert.

Best regards,
Cosmin
User avatar
xnview
Author of XnView
Posts: 43327
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Incorrect display of 16-bit raw PNM

Post by xnview »

could you send me a sample?
Pierre.
cosmin
Posts: 4
Joined: Mon Nov 03, 2008 1:56 am
Location: Toronto

Post by cosmin »

Pierre, here is a sample:

http://cosmin.users.sourceforge.net/tes ... 6g_lin.pgm
http://cosmin.users.sourceforge.net/tes ... 6g_lin.png

This is Lena in grayscale, downscaled and converted to 16-bit linear colorspace.

The PNG file was created out of the PGM file using OptiPNG. Any other common PNM-to-PNG converter would give you the same (correct) PNG output. The PNG image is displayed properly in XnView, but the PGM image is garbled.
The same happens with PPM images. If you want a PPM sample as well, please let me know.

I hope this helps.

Best regards,
Cosmin
Post Reply