How to Detect colour in a Image.

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
salahuddinonline
Posts: 24
Joined: 2013-07-14T03:36:12-07:00
Authentication code: 6789

How to Detect colour in a Image.

Post by salahuddinonline »

Hi there,

hope all of you are doing great,
I have more then 1000 images in a directory, and I want imagemajick to find colour code which is (fedcb7) in all these images, if colour found, move image to another directory which is named Processed,

can any one help me out on this,

Regards,
Salahuddin
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to Detect colour in a Image.

Post by snibgo »

The following command will count the number of pixels that are the required colour.

Code: Select all

convert logo: ( +clone -fill black -opaque #fedcb7 ) -metric AE -compare -format "%[distortion]" info:
You could use it in a script to move images that have a count of more than zero.
snibgo's IM pages: im.snibgo.com
salahuddinonline
Posts: 24
Joined: 2013-07-14T03:36:12-07:00
Authentication code: 6789

Re: How to Detect colour in a Image.

Post by salahuddinonline »

Its not working snigbo

I want to find a colour in image,,,, if found ,, move this image to another directory
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: How to Detect colour in a Image.

Post by Bonzo »

You could use it in a script to move images that have a count of more than zero.
That can not be done with Imagemagick and as snibgo says you will need to write some extra code - batch file, shell script etc. to do the moving.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to Detect colour in a Image.

Post by fmw42 »

You will need to script a loop over each image, then test for the color, then move it using the OS (not IM) if the color is found. But the scripting method depends upon your OS. Please (always) provide your IM version and platform when asking questions.
Post Reply