PAM (Netbpm P7) file with e.g. 12 bits is almost gray

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

Moderators: XnTriq, helmut, xnview

Post Reply
MortenZdk
Posts: 3
Joined: Wed Mar 15, 2017 6:15 pm

PAM (Netbpm P7) file with e.g. 12 bits is almost gray

Post by MortenZdk »

Trying to show a simple PAM (Netbpm P7) file, the presentation is almost gray.

This looks like a bug in presentation of 12-bit files, thus with pixel values larger than 8 bits or maxval higher than 255.

The PAM (Netbpm P7) format is described here: http://netpbm.sourceforge.net/doc/pam.html

Simple example file is attached. Note that files was packed, since I got an message that .pam file is not allowed. However, XnView does support viewing of .pam, and works find for 8 bit values.
Attachments
p7_3x2_12b_3d.zip
Unpack to get .pam file, since I got message that .pam file was not allowed.
(188 Bytes) Downloaded 240 times
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: PAM (Netbpm P7) file with e.g. 12 bits is almost gray

Post by XnTriq »

Welcome to the forum, MortenZdk.

“The picture will be converted to RGB with 8bits per component” because XnView Classic (and MP) currently don't have full support for 12/16/32 bits.
Wikipedia (Netpbm → [url=http://en.wikipedia.org/wiki/Netpbm#PAM_graphics_format]Portable Arbitrary Map[/url]) wrote:Portable Arbitrary Map (PAM) is an extension of the older binary P4…P6 graphics formats. PAM generalises all features of PBM, PGM and PPM, and provides for extensions. PAM defines two new attributes; depth and tuple type:
  1. The depth attribute defines the number of channels in the image, such as 1 for greyscale images and 3 for RGB images.
  2. The tuple type attribute specifies what kind of image the PAM file represents, thus enabling it to stand for the older Netpbm formats, as well as to be extended to new uses, e.g., transparency.
As of 2015 PAM is not widely accepted or produced by graphics systems; e.g., XnView and FFmpeg support it. As specified the TUPLTYPE is optional; however, FFmpeg requires it.
p7_3x2_12b_3d.pam converted to PNG with XnView v2.39:
 
Attachments
p7_3x2_12b_3d.png
p7_3x2_12b_3d.png (72 Bytes) Viewed 4243 times
MortenZdk
Posts: 3
Joined: Wed Mar 15, 2017 6:15 pm

Re: PAM (Netbpm P7) file with e.g. 12 bits is almost gray

Post by MortenZdk »

Hi XnTriq,

Thanks for attending to my issues.

I understand that XnView, and lots of other image viewers does not support more than 8 bits per layer, which is OK, since more does not make sense anyway in the presentation on a monitor.

However, my issues is merely that the image does convert correctly when the pixel components are more than 8 bits. I would expect that an image only using 0 and maxval would look the same, but that is not the case.

I have attached a number of PAM examples, going from 1 bit (maxval = 1) to 16 bit (maxval = 65535), and this shows that XnView does not handled 2 byte component values correctly, since the view changes when going from 8 bit (maxval = 255) to 9 bit (maxval = 511), where 2 bytes are required.

Can I do anything to help fixing this, since I would very much like PAM with 2 byte components to show correctly in XnView ?

Best regards
MortenZdk
Attachments
pam_examples.zip
Several examples of the same image with different bits per component.
(1.14 KiB) Downloaded 186 times
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: PAM (Netbpm P7) file with e.g. 12 bits is almost gray

Post by XnTriq »

MortenZdk wrote:However, my issues is merely that the image does convert correctly when the pixel components are more than 8 bits. I would expect that an image only using 0 and maxval would look the same, but that is not the case.
OK, I see.
MortenZdk wrote:Can I do anything to help fixing this, since I would very much like PAM with 2 byte components to show correctly in XnView ?
Providing samples – which you've already done – is the best way to help the developer of XnView (Pierre).
I believe he's very busy right now getting the beta of MP v0.85 out, but hopefully he'll find the time to look into this.
User avatar
XnTriq
Moderator & Librarian
Posts: 6336
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: PAM (Netbpm P7) file with e.g. 12 bits is almost gray

Post by XnTriq »

FYI: Support for the PAM format has been added in XnView MP v0.85.
MortenZdk
Posts: 3
Joined: Wed Mar 15, 2017 6:15 pm

Re: PAM (Netbpm P7) file with e.g. 12 bits is almost gray

Post by MortenZdk »

Hi XnTriq,

Just tried it in XnView MP, and it works fine :)

Thanks for the effort :D

Best regards MortenZdk
Post Reply