Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 82
  • Last Modified:

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.
0
rafaelrgl
Asked:
rafaelrgl
  • 2
1 Solution
 
Brad GrouxCommented:
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.
0
 
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.
0
 
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
0
 
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.
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now