Howto convert random image (no knowledge on profile) to sRGB

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
JimKerr

Howto convert random image (no knowledge on profile) to sRGB

Post by JimKerr »

Hi,

I would like to know how I can use IM to convert any image to a sRGB image. I have a sRGB.icc colour profile file, and I want all the input images converted to this profile. The input images could have any colour profile of maybe they don't even have a profile at all.

Can someone help me with this? Thanks!
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Howto convert random image (no knowledge on profile) to

Post by fmw42 »

for best results you need to know the input image color profile. see http://www.imagemagick.org/Usage/formats/#profiles
JimKerr

Re: Howto convert random image (no knowledge on profile) to

Post by JimKerr »

So I should build in a check to get the input profile, and use this input profile to convert the image to sRGB.
But what if there is no embedded profile in the image, and how would the commandstring look like to do all this?
martinw17
Posts: 39
Joined: 2006-09-07T02:10:27-07:00
Location: Brighton, UK

Re: Howto convert random image (no knowledge on profile) to

Post by martinw17 »

JimKerr wrote:So I should build in a check to get the input profile, and use this input profile to convert the image to sRGB.
If the image contains the 'source' profile (i.e. fully embedded in it, not just the name) then you need only specify the 'destination' profile: if you specify only one -profile flag then convert will automatically use the embedded profile (if it is there).
The problem is that if the image doesn't contain a profile then you need to specify both the 'source' and 'destination' profiles.

We had a similar issue and ended up using USWebCoatedSWOP.icc as the source (CMYK) profile if the image didn't contain one. This gives much better results than using the -colorspace option, although I guess that depends on your images, i.e. which color profiles were used to create them.

See viewtopic.php?f=1&t=9149 for more about this.

Regards,
Martin
Post Reply