bitbank2 / PNGdec

An optimized PNG decoder suitable for microcontrollers and PCs
Apache License 2.0
172 stars 28 forks source link

How to decode this image? #2

Closed perlix closed 2 years ago

perlix commented 2 years ago

Thanks for this well documented library! Works great, also for transparent images.

However, there's a certain type of png files that I didn't manage to decode properly so far. For example: https://tiles.wmflabs.org/hillshading/10/526/340.png

Looks like it's being rendered as fully transparent, although hasAlpha() returns 0. The library further reports: image specs: (256 x 256), 8 bpp, pixel type: 3;

I should add that the image from the above link is strange anyway, as it looks OK in web browsers and in Microsoft applications (e.g MS Paint), but not in tools like Gimp or Irfanview. Wonder if there's a way to decode it properly with PNGdec?

perlix commented 2 years ago

Guess I found it. Looks like there's so little contrast in the image that every pixel becomes white in RGB565.

bitbank2 commented 2 years ago

Thank you for sharing your experiences with PNGdec - I'm glad it mostly works for your needs. That makes sense - on a good monitor I could barely see any variations in the pixels when rendered as RGB888.