Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a hint when an image can't be decoded, but it is a valid image #57

Open
alexwlchan opened this issue Aug 12, 2024 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@alexwlchan
Copy link
Owner

I've just worked on a collection of images which dominant_colours refused to look at, because they were named with JPEG file extension but were actually WebP images. Here's a simple repro:

$ cp src/tests/purple.webp src/tests/purple.jpg

$ dominant_colours src/tests/purple.jpg
Format error decoding Jpeg: Error parsing image. Illegal start bytes:5249

$ file src/tests/purple.jpg
src/tests/purple.jpg: RIFF (little-endian) data, Web/P image, VP8 encoding, 1x1, Scaling: [none]x[none], YUV color, decoders should clamp

Under the hood, dominant_colours is using Rust's image crate which relies on file extensions.

In this project, I was able to change the file extensions to match the image type, but I had to know to run file to identify that these were really valid images.

It would be useful if dominant_colours could suggest that a thing that looks like a JPEG image is actually a WebP image, or some other error message that points in the right direction.

@alexwlchan alexwlchan added the enhancement New feature or request label Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant