bkaradzic / bimg

Image library.
BSD 2-Clause "Simplified" License
327 stars 268 forks source link

image_decode doesnt support 1-4bit PNG Palette #39

Closed v0l closed 4 years ago

v0l commented 4 years ago

https://github.com/bkaradzic/bimg/blob/master/src/image_decode.cpp#L110

Example image: https://tile.openstreetmap.org//5/13/13.png

The image is only 1bit bitdepth, but the colortype is LCT_PALETTE

Might be better to switch on colortype then bitdepth

Output from pnginfo

13.png...
  Image Width: 256 Image Length: 256
  Bitdepth (Bits/Sample): 1
  Channels (Samples/Pixel): 1
  Pixel depth (Pixel Depth): 1
  Colour Type (Photometric Interpretation): PALETTED COLOUR (1 colours, 0 transparent)
  Image filter: Single row per byte filter
  Interlacing: No interlacing
  Compression Scheme: Deflate method 8, 32k window
  Resolution: 0, 0 (unit unknown)
  FillOrder: msb-to-lsb
  Byte Order: Network (Big Endian)
  Number of text strings: 0
bkaradzic commented 4 years ago

If you have fix you can send PR.

v0l commented 4 years ago

I only load png so i switch to use lodepng directly

bkaradzic commented 4 years ago

So you don't have problem then?