Getting most prominent colour

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
pratikpoddar
Posts: 1
Joined: 2013-02-22T13:27:11-07:00
Authentication code: 6789

Getting most prominent colour

Post by pratikpoddar »

I have images of e-commerce products (shirts, skirt, jeans) and I want to find the colour of the product - so ignore the background, pretty face etc. Just focus on the product. How can this be done with some degree of reliability?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Getting most prominent colour

Post by fmw42 »

What file format? What version of IM are you using and what platform?

The main idea would be to reduce colors if needed depending upon format and get the top entries from the histogram. But the background may have a larger count than the shirt color depending upon how much background.

See
http://www.imagemagick.org/Usage/files/#histogram
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Getting most prominent colour

Post by snibgo »

You need to work out what, visually, distinguishes the product from everything else. Is it always in the centre of the image? Is it the most common colour? Is the background constant for all the images?

You also need to decide what you want reported. Is a primary colour (like red, green, blue, cyan, magenta, yellow) sufficient?
snibgo's IM pages: im.snibgo.com
Post Reply