lvandeve / lodepng

PNG encoder and decoder in C and C++.
zlib License
2.06k stars 421 forks source link

unsigned int not supported as image and buffer #75

Closed tharindu-mathew closed 6 years ago

tharindu-mathew commented 6 years ago

It seems only 8 bit buffers are supported. But, 16 bit needs unsigned ints or similar, if the 16 bit is already available to the user, who doesn't want to downsample it to 8bit.

lvandeve commented 6 years ago

16-bit color is indeed available, for RGB, RGBA, greyscale and greyscale+alpha. It stores them in an 8-bit unsigned chars buffer, but using 2 unsigned chars per pixel

For example if you have 16-bit RGB, it will use 6 bytes per pixel.

The values are in big endian order, just like they are inside the PNG file format

Please check out the code snippet in the comment in https://github.com/lvandeve/lodepng/issues/74 to see a working example (greyscale in that case)

Please feel free to reopen this bug if you have any further questions about this :)