POV-Ray : Newsgroups : povray.general : .pgm 16 bit : Re: .pgm 16 bit Server Time
27 Apr 2024 04:54:52 EDT (-0400)
  Re: .pgm 16 bit  
From: clipka
Date: 8 Oct 2016 01:26:55
Message: <57f8839f$1@news.povray.org>
Am 07.10.2016 um 22:40 schrieb ingo:
> Ran into this before, long time ago, still confused.
> 'd like to write 16 bit greyscale files from an array[][] to use them in
> a hight-field (in the same scene).
> Tried different packages to generate .pgm's, many won't work. Some do
> and it seems POV-Ray can use 16 bit greyscale pgm's for HF's despite
> what the docs say.
> 
> What would be the exact form of 16 bit pgm's that POV-Ray supports?

http://netpbm.sourceforge.net/doc/pgm.html, with the following limitations:

- Where the specification allows arbitrary whitespace between width and
height, POV-Ray requires this to contain neither CR nor LF.

- Where the specification allows an arbitrary single whitespace
character between the height and the maxval, POV-Ray requires this
whitespace character to contain at least one line break.

- Where the specification allows an arbitrary single whitespace
character between the maxval and the raster, POV-Ray requires this
whitespace character to be a line break.

- Where the specification allows comments ("#" followed by arbitrary
characters followed by a newline; see
http://netpbm.sourceforge.net/doc/pbm.html) anywhere in the header (the
portion before the single whitespace right before the raster), POV-Ray
requires any comments to reside in otherwise blank lines.

- I'm not sure right off the top of my head whether POV-Ray allows VT or
FF whitespace charaters in the file.


Also, current versions of POV-Ray do not gamma-correct PGM input files
unless you explicitly specify the gamma (using the `gamma` keyword).


Other than that, I'm not aware of any limitations.

POV-Ray supports both binary (P5) and ASCII (P2) PGM files.

POV-Ray 3.7 can write binary data; see the `ARRAYS_WriteDF3()` macro in
`arrays.inc` for sample code. As a matter of fact, that macro happens to
also export a multi-dimensional array as a binary file, albeit as DF3
rather than PGM, but it should be easy enough to adapt for binary PGM
export.


Post a reply to this message

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