question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

4 bpp PNGs not supported: Unexpected colourType: 3

See original GitHub issue

Would be great if this package supported more color types, including 4 bits per pixel in PNGs.

Currently I get this error when loading such images in Node:

> (node:11512) UnhandledPromiseRejectionWarning: Error: Unexpected colourType: 3
    at loadPNG (image-js/lib/image/core/load.js:123:13)
    at loadBinary (image-js/lib/image/core/load.js:66:16)
    at binaryDataP.then.binaryData (/image-js/lib/image/core/load.js:95:12)

Example 4 bpp image: circle

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tgrajewskicommented, Sep 11, 2018

Yes, it works great, thanks!

1reaction
targoscommented, Sep 8, 2018

This should be fixed in version 0.21.1 (commit). I added a test with your image and another one with a palette saved from Photoshop.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PNG (Portable Network Graphics) Specification - W3C
Source data with a precision not directly supported in PNG (for example, ... bpp is equal to 1 (rounding up); for color type...
Read more >
Cannot load 48 bpp PNG (Bit depth is not supported or not valid)
Prerequisites. I have written a descriptive issue title; I have verified that I am running the latest version of ImageSharp
Read more >
lodepng.h
The colortype and bitdepth of the output PNG image cannot be chosen, they are automatically determined ... The palette is only supported for...
Read more >
Chapter 8, "PNG Basics" - libpng.org
Palette-based images, also known as colormapped or index-color images, use the PLTE chunk and are supported in four pixel depths: 1, 2, 4,...
Read more >
error.rs.html -- source - Docs.rs
Something that doesn't happen in a normal, well encoded, PNG image. ... 42 => "tRNS chunk appeared while it was not allowed for...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found