Page 1 of 1
Get Dominant Color from imageData
Posted: Thu Nov 29, 2012 2:05 pm
by qberty1337
Hey there,
I don't normally ask for help, so I could be doing this wrong, but what would be the most efficient way to find the most dominant color in an image using it's imageData?
The best I could come up with is going through every pixel and grabbing it's RGB and getting an average? Or maybe compiling a list of RGB values that are similar?
Re: Get Dominant Color from imageData
Posted: Thu Nov 29, 2012 5:15 pm
by jmburnod
Hi qberty1337
I think the stack in attachment does a part of the job.
It is an adaptation of a Bernd's script "replace white with blue" I named it "GetColorsImages"
The button write a list of the colors RGB and sort it by the last item (the num of occurences)
Best regards
Jean-Marc
Re: Get Dominant Color from imageData
Posted: Mon Dec 24, 2012 2:26 pm
by qberty1337
Wow, thanks for making a demo stack like that.
The only thing I hate is that it takes soo long for LC to grab those values of a small image like that.
I just wish there was a quicker way to get the most seen colour from an image.
Re: Get Dominant Color from imageData
Posted: Mon Dec 24, 2012 5:16 pm
by Mark
Hi,
Resize the image object to make it fit 100x100 px and get the imageData. That should speed it up, although it will be less accurate.
Kind regards,
Mark
Re: Get Dominant Color from imageData
Posted: Tue Dec 25, 2012 2:09 pm
by qberty1337
I was thinking of doing that. But if I had a complicated image like Album Cover Art for music files, then derezzing' it would make my dominant colour completely inaccurate.
