Results 1 to 3 of 3
Thread: Extract main colors from image
Jun 1, 2007, 09:59 #1
Extract main colors from image
I am looking for a script to extract the main/most used colors in an image.
I wrote a function that uses the GD library to extract all the colors, I sort them in an array.
The problem is, I have various sorts of blue in the array. How would I limit it to only use colors that are clearly different from each other?
An example of a script that does what I would like to do:
Thank you for your reply
Jun 1, 2007, 12:05 #2
Here's how I would do it. First I am guessing you are going through the image pixel by pixel. Instead of saving the colour save the number of degrees around the colour wheel. That will give you an array with 360 entries. Each time you test a colour and find the degrees increment that key by one. Once you have gone through the whole image it is simple a matter of looking for the peaks in the array.
Jun 1, 2007, 12:46 #3
- Join Date
- Sep 2006
- Fairbanks, AK
- 0 Post(s)
- 0 Thread(s)