Matthew Trentacoste wrote: > I do work with high dynamic range images and would like to see about > extending PIL to support them. For those unfamiliar, the primary > difference is that all the channels are floating point. > > I've more or less deconstructed the way that the importer/exporter > code works, but wanted to check on what to do to be able to create > images that contain 3 floating point channels. > > What all do I need to do? > + Add an experimental mode? > + Add a memory mapping? > + Add a new case to storage.c? > > Any pointers and help would be greatly appreciated.
Hi Matt, You might want to have a look at this: http://starship.python.net/crew/schorsch/pilray.html It's very old (PIL 1.0) and probably not very pretty, but it worked for what I needed at the time. I had to create a custom RGBf mode because the existing F mode is single channel. If you should happen to work with the Radiance image format, then you could use my import/export code, probably with very little change. I would be happy to contribute that to the official PIL release, if Fredrik wants it. I also experimented a bit with storing the data the same way Radiance does (RGBE: four ints, the mantissa of each RGB channel and a common exponent), which would save a lot of space at a slight computational expense. I don't remember why I didn't continue into that direction. My attempts at tonemapping for converting into other image formats are probably the ugliest part of the package. I used some code taken from Radiance, which was even less modular at the time than it is today. I think it is also easier to write extensions to PIL with newer versions, but haven't checked the details yet. In any case, this may be the part where you need to invest the most thought and effort to get something better than I did. Good luck! -schorsch -- Georg Mischler -- simulations developer -- schorsch at schorsch com +schorsch.com+ -- lighting design tools -- http://www.schorsch.com/ _______________________________________________ Image-SIG maillist - [email protected] http://mail.python.org/mailman/listinfo/image-sig
