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

inconsistent sampling for population by palette size #27

Closed
hwaynefair opened this issue Jun 21, 2018 · 4 comments
Closed

inconsistent sampling for population by palette size #27

hwaynefair opened this issue Jun 21, 2018 · 4 comments

Comments

@hwaynefair
Copy link

hwaynefair commented Jun 21, 2018

RgbQuant is awesome!

I am using it in an application for beginning artists (painters) - reducing an image to a minimal number of colors...etc.

The strange behavior I find is that when I get a palette size of 10 - orange (in this particular case) is one of the most predominant color - and green doesn't show in the top 10 colors.

But when I get a palette size of 15 - green (which is far more visually correct) is the predominant color (by population).

Can you give me any advice on this?

Thanks so much!

var q = new RgbQuant({ colors: getSlice });
q.sample(ctx);
var color = q.palette(true, true);

slice15
slice10

@leeoniya
Copy link
Owner

hey @hwaynefair ,

Can you link the original image here?

RgbQuant doesnt do great on very low color palette sizes (< 16). You can read a bit more in #12. I'm currently on vacation, but will take a look in about a week. In the mean time, try bumping up the minHueCols setting.

@hwaynefair
Copy link
Author

Really appreciate your timely response (well - any response at all for that matter)!
I will do as you advised - and please find the original image attached.

FYI - my "objective" here is to "paint" the HTML canvas with around 10 colors that are not too close to one another in value - to serve as an "under-painting" on the "real" canvas on which the artist is painting....

Thanks again!
-wayne

light44ea973d-68e6-455f-bf65-d9f243ffbda9

@leeoniya
Copy link
Owner

leeoniya commented Jul 8, 2018

i added this lily pond image to the demo page (i can remove it if this is a problem, btw) and i cannot get it to produce the results in your screenshot with a 10-color palette. can you test it out here and see if the results are still the same for you?

http://leeoniya.github.io/RgbQuant.js/demo/

thanks!

@hwaynefair
Copy link
Author

hwaynefair commented Aug 25, 2018

Leon - you are so kind to go the extra mile with me on this. I apologize for my very late response.... I failed to notice the notification on github - and have been very distracted from my art application for several weeks -
I did quickly run the demo using my image you added there - and it works perfectly!
I will dig further into my code and see if I can isolate the issue on my side...
Thanks again for your kindness!
-wayne

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

No branches or pull requests

2 participants