Skip to content

Can't load image with 16 colors + transparency #35

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

Closed
ollej opened this issue Dec 31, 2024 · 2 comments · Fixed by #38
Closed

Can't load image with 16 colors + transparency #35

ollej opened this issue Dec 31, 2024 · 2 comments · Fixed by #38

Comments

@ollej
Copy link

ollej commented Dec 31, 2024

I have a PNG image that I'm pretty sure uses only the 16 allowed colors, plus transparency. But when building I get the following error:

💥 Error: convert file: the image has too many colors.

If I remove one color (black in this case), it works. I've checked the file with imagemagick histogram and it only has the allowed colors.

It would be nice if the error message printed which file and which color is incorrect as well.

spritesheet

@orsinium
Copy link
Member

We can support only 16 colors or 15 colors plus transparency. Each pixel in image encoded with 4 bits, which gives 16 possible values for colors and transparency included. I thought about using a bitmap for transparency but it gets wasteful.

It would be nice if the error message printed which file and which color is incorrect as well.

Great suggestion! Let's improve error messages.

@orsinium orsinium transferred this issue from firefly-zero/firefly-rust Dec 31, 2024
@ollej
Copy link
Author

ollej commented Jan 2, 2025

Ok. Then I think the documentation needs to be clarified regarding this.

https://github.com/firefly-zero/docs.fireflyzero.com/blob/306a2c9ae8b1b105249f1382f68e26bb07ee20f9/content/dev/graphics.md?plain=1#L221

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants