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

Palette statistics #39

Open
ksesong opened this issue Apr 1, 2018 · 1 comment
Open

Palette statistics #39

ksesong opened this issue Apr 1, 2018 · 1 comment

Comments

@ksesong
Copy link

ksesong commented Apr 1, 2018

I was wondering whether we could have access to the palette statistics (how many times a color has been used). I am doing two passes right now, one to compute the palette, and another one to quantize an image (with NearestColor), before comparing the pixels with the palette (to gather statistics).
This seems quite unoptimized.

I have been trying to look at the _idxi32 property of the palette, but I couldn't get the information consistently.
Thanks!

@ibezkrovnyi
Copy link
Owner

ibezkrovnyi commented Apr 2, 2018

if I get question right palette has no required color statistics at all.
I recall RGBQuant uses rgba (uint32) statistics internally (probably not what you need)

Re _idxi32: private _i32idx is used in Palette as cache for rgba color => palette index conversion, cache is built during array/nearest color/riemersma image quantizing. Cache is cache, even after one ImageQuantizer pass, _i32idx has not all i32 (rgba) keys, but only queried by quantizer algorithm, it is even cannot be guaranteed _i32idx will have all i32 values from image (because of implementation details of ImageQuantizer algorithms).

It would be nice to see use case to understand what is needed.

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

No branches or pull requests

2 participants