match colors like in Photoshop?

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
airBourne
Posts: 3
Joined: 2013-07-22T12:32:55-07:00
Authentication code: 6789

match colors like in Photoshop?

Post by airBourne »

Hey guys,
Is there an ImageMagick feature/routine which will enable me to match the colors of one image to a second image? I'm looking for something similar to the Photoshop 'match color' tool referenced here:

http://www.peachpit.com/articles/article.aspx?p=706213

My situation: I have an image mosaic of Color-infrared aerial photographs for which I've used ImageMagick to process. However, the final processing step as suggested by the manufacturer of our camera is to take our image mosaic and match the colors to an existing CIR aerial photograph for a final product. I have an old version of Photoshop that doesn't have this feature--and I'd prefer to avoid Photoshop anyhow--and was wondering if this were possible with ImageMagick.

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

Re: match colors like in Photoshop?

Post by snibgo »

The article doesn't say what PS actually does.

You can recolour an image so every pixel becomes as close as it can to a colour in another image:

Code: Select all

convert in.png reference.png -dither -remap out.png
If this doesn't do what you want, can you provide sample images?
snibgo's IM pages: im.snibgo.com
rich2005
Posts: 32
Joined: 2012-04-09T11:07:36-07:00
Authentication code: 8675308

Re: match colors like in Photoshop?

Post by rich2005 »

Is that correct?

Using convert in.png reference.png -dither -remap out.png

I get an error
convert: unrecognized dither method `-remap' @ error/convert.c/ConvertImageCommand/1285

Looking at the documents -dither takes a switch so

convert in.png -dither None -remap reference.png out.png

works

but what is your advice on the dither options? None/Riemersma/FloydSteinberg (any others?)

Using PClinuxOS and ImageMagick 6.8.0-2 2013-04-13 Q16
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: match colors like in Photoshop?

Post by fmw42 »

but what is your advice on the dither options? None/Riemersma/FloydSteinberg (any others?)
I do not think there is any best method. Just try each and use whatever looks best for your image.

-dither none is like no dithering or +dither, so for dithering you only have two choices. I am not sure which is used by default.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: match colors like in Photoshop?

Post by snibgo »

Gosh, I fouled up the syntax badly. That should have been:

Code: Select all

convert in.png -remap reference.png out.png
See http://www.imagemagick.org/script/comma ... ptions.php
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: match colors like in Photoshop?

Post by fmw42 »

Perhaps it is doing something like my histmatch script. However, some tests seem to show that -remap seems to work better.
Post Reply