Closed kornelski closed 6 years ago
You're correct, 1-bit RGB does not exist in PNG and is not supported by lodepng either since it only supports the valid PNG color type / bit depth combinations.
In the unit test, the 1 there was a typo, it actually had to be 8, and the test passed by coincidence instead (since it was treating it as 16 bit in the else case and the bit pattern must have matched something valid by coincidence)
Extra error handling in the lodepng_convert and lodepng_get_raw_size functions would be redundant, the error checking for valid color type / bit depth combination already happens elsewhere in the main decoding and encoding flow
Thanks for reporting! I fixed the test to use 8, and 16, instead of the wrong 1 bits.
In the unit tests there's one test with "1-bit RGB" color:
I'm not sure if that test is valid. AFAIK PNG doesn't allow 1bpp in RGB mode.
There's disagreement between
lodepng_get_raw_size()
which calculates size for 1bpp, andgetPixelColorRGBA8
which does not (the implementation assumes that only 8 and 16 are valid)