| ▲ | dgently7 2 hours ago | |||||||
"Let’s say you’re writing an image processing program. The program takes in an image, converts it to floating point, does some processing and finally saves the modified pixels to disk as 8-bit colors. " excuse to argue about the best way aside, if this is the goal you should not be rolling your own image file reading. you should use openimageio. idk what approach it takes in its internal conversion to float, but that library is more likely to have the right answer than you trying to roll it yourself given its the library used internally by tons of professional image manipulation software... | ||||||||
| ▲ | pixelesque an hour ago | parent | next [-] | |||||||
If you're a beginner, or just want something which works quickly, sure. However OIIO is far from perfect in all situations (having had to debug and fix issues with its mip-map generation filtering code in the past), so don't always assume that just because there's a mature open source library out there doing something that it's always perfect. | ||||||||
| ||||||||
| ▲ | AgentME an hour ago | parent | prev [-] | |||||||
OpenImageIO uses the standard division by 255 technique: https://openimageio.readthedocs.io/en/latest/imageoutput.htm... | ||||||||