[Radiance-general] transform from Radiance to PPM file

Peter Apian-Bennewitz [email protected]
Thu, 03 Oct 2002 10:32:19 +0200


Qing Xu wrote:
> 
> Dear all,
> I use the "rtrace" to get the radiance value for each pixel on an image.
> 
> I know that there are some related clues inside the Radiance or source
> codes, but I do not have much time to look into the Radiance. Could you
> please give me some suggestion on how to transform from pixel value to
> the value that PPM file needs?
> 
> Thanks a lot in advance!
> 
> Qing Xu
> 
> _______________________________________________
> Radiance-general mailing list
> [email protected]
> http://www.radiance-online.org/mailman/listinfo/radiance-general

Hi Qing Xu,

rtrace gives floating point values, PPM uses 8bit integers (the format
is flexible and could handle more bits, but that is rarely supported).
So, to render a PPM image with rtrace, you'll have to scale the floating
point values and use something like:
	(echo -e "P3\n1 1\n255" ; ( echo 10 10 10 -1 -1 -1 | rtrace -ov -h
teich.oct | awk '{printf "%d %d %d\n", 255*$1/3e-1, 255*$1/3e-1,
255*$1/3e-1}' ) ) > q
Of course, you'll have to feed appropriate input to rtrace. The whole
exercise seems a bit exotic, what's your reason not to use rpict ?

Should you'll be looking for converting from a pic file (rendered by
rpict or rview) to PPM, use ra_ppm .

regards
Peter
-- 
 pab-opto, Freiburg, Germany, www.pab-opto.de