-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
LibGfx/GIF: Support Colors #24330
LibGfx/GIF: Support Colors #24330
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So image
just TODO()
s now if you give it an input with > 256 colors and ask for gif output? That's maybe a bit unfriendly.
Anyways, looks fine (even with that TODO). Some comments below, address the ones that you think are useful. (They're a bit rambly.)
No it doesn't, as an example the image in the PR description has more than 256 colors. It TODOs if the input color was not present during the creation of the palette. Currently, there is no way to hit that TODO in the code. But we will quickly face it if we try to encode new frames with the same palette. I started to resolve some comment locally, but I'll do the rest tomorrow. |
f188bb1
to
c1e43d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Still LG
(maintainers: feel free to hit merge! My 2 comments below are minor nits and optional, and can be in a follow-up of they're addressed at all. I'm excited about having this in tree.) |
This is useful to find the best matching color palette from an existing bitmap. It can be used in PixelPaint but also in encoders of old image formats that only support indexed colors e.g. GIF.
To determine the palette of colors we use the median cut algorithm. While being a correct implementation, enhancements are obviously existing on both the median cut algorithm and the encoding side.
You can clearly see the lack of diversity in the colors due to the size of the table being limited to 256 elements.