how to know which color is predominant on jpg, bmp files

Hi, I want to see if it is possible to have one function that check one jpg file that is upload on my website and return the most predominant colors used on one jpg or bmp file.

Is this possible.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brad GrouxSenior Manager (Wintel Engineering)Commented:
It isn't possible with any out of box solution that I know of, if it is possible it would have to be a custom application. Online editing apps like Pixlr have the ability to identify the color with the color selector tool so it isn't difficult to have a web app identify a color from an image or selection... however, the added complexity of scanning every pixel in an image and then determining which color is the most predominant would take some pretty difficult logic programming.

Long story short, it should be possible - but it probably won't be easy.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Paul MacDonaldDirector, Information SystemsCommented:
A histogram is what you're referring to, and there are several graphics programs that will provide one of an image you have loaded in them, but I'm not aware of any web capability (.Net or otherwise) that will do this programatically.  That doesn't mean something like that doesn't exist.

I'll see what I can turn up for you.
rafaelrglAuthor Commented:
Ok, lets say we read all pixels one by one in the image and store inside one list with the color and the number of times it found the color. so we could get some table like this below, then we would know witch color is predominant.

color         count

#ffffff       1005
#894585        256
#70b23f        3345
#d4ffff        6345
#65ab7c        747
#952e8f        9345
#fcfc81        134
#a5a391        8345
Paul MacDonaldDirector, Information SystemsCommented:
Yes, you could do that.  It's worth noting there's more to it than that, though, I think, unless you're literally after the most frequent color.  #FFFFFF, #FEFFFF, #FFFEFF, #FFFFFE will all look white to the human eye, but would be counted separately.    If that's close enough, then that might be an approach to take.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.