POV-Ray : Newsgroups : povray.beta-test : Suspicious PGM/PPM file format handling : Suspicious PGM/PPM file format handling Server Time
6 Jul 2024 06:33:24 EDT (-0400)
  Suspicious PGM/PPM file format handling  
From: clipka
Date: 14 Sep 2009 08:49:13
Message: <4aae3bc9@news.povray.org>
While digging through the image reading code for PGM and PPM files, I 
noticed something strange regarding the handling of the "maxvalue" 
header field:


(A) In PPM files, the value appears to be consistently interpreted as 
the value that would represent 1.0. The same applies to PGM files with a 
"maxvalue" of 255 or less.

(B) For PGM files with a "maxvalue" of 256 or higher however, maxvalue 
appears to be effectively ignored, and the values interpreted as if 
65535 would represent 1.0.


Can someone confirm this in practice?

Any suggestions how to handle this? I would consider (B) a bug and 
change it - even at the cost of potentially breaking existing scenes, 
speculating that most files with a "maxvalue" > 255 do have a value of 
65535 anyway.


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.