How do I preserve the color of this white png in composite?

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
builtbylane
Posts: 2
Joined: 2013-07-24T17:55:38-07:00
Authentication code: 6789

How do I preserve the color of this white png in composite?

Post by builtbylane »

Why is this happening? Is this a bug? how can I keep my transparent white.png white?

white.png : http://cl.ly/image/1Q1U2A461g2V
background.jpg : http://f.cl.ly/items/08173P2o0g3F3M2930 ... ground.jpg

Code: Select all

composite -gravity center  -resize "10000x416>" white.png background.jpg dark.jpg
I want a white watermark, but I'm getting a dark one. produces : http://cl.ly/image/3U2F1r1L3D3m


Version: ImageMagick 6.8.6-3 2013-07-06 Q16
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I preserve the color of this white png in composi

Post by fmw42 »

Your background JPG is CMYK (U.S. Web Coated Swop) and IM cannot composite unless both are sRGB. You need to use an sRGB.icc profile to convert the background first.

convert \( background.jpg -profile /Users/fred/images/profiles/sRGB.icc \) white.png -flatten result.jpg

replace the blue path with your path to your sRGB.icc profile.


see http://www.imagemagick.org/Usage/formats/#profiles
builtbylane
Posts: 2
Joined: 2013-07-24T17:55:38-07:00
Authentication code: 6789

Re: How do I preserve the color of this white png in composi

Post by builtbylane »

Thank you thank you! You have really helped me.

I have a followup question... is there a way with imagemagick to test the color profile before applying a conversion?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How do I preserve the color of this white png in composi

Post by fmw42 »

use

identify -verbose yourimage

That will list out all the information. The colorspace should say CMYK or sRGB. Or at the bottom, you can see the exact profiles included with the file.
Post Reply