How to Add ICC Color Profile with ImageMagick?
Adding an ICC color profile to an image ensures consistent and
accurate color representation across different screens and printing
devices. This article provides a quick overview of how to use the
ImageMagick convert (or magick) command to
embed or transform color profiles, covering basic syntax, the difference
between assigning and converting profiles, and how to verify that the
profile was successfully applied.
Understanding the Basics
ImageMagick uses color profiles to manage how colors are interpreted. When working with digital images, you generally deal with two scenarios: assigning a profile to an unprofiled image, or converting an image from one color space to another (such as RGB to CMYK for printing).
In newer versions of ImageMagick (v7 and above), the
convert command has been replaced by the primary
magick command, though convert is still widely
supported as a legacy alias.
Embedding vs.Ā Converting Profiles
There are two primary operations when handling ICC profiles in
ImageMagick: -profile used once, and -profile
used twice.
1. Assigning a Profile (No Direct Color Alteration)
If your image does not have an embedded color profile, you can assign one. This tells software how to read the existing raw color data without actually changing the pixel values themselves.
magick input.jpg -profile /path/to/sRGB.icc output.jpg2. Converting a Profile (Altering Pixel Data)
If your image already has an embedded profile (like sRGB) and you want to convert it to a different color space (like a CMYK profile for printing), you must specify the profile option twice. The first instance recognizes the current profile, and the second instance applies the target transformation.
magick input.jpg -profile /path/to/sRGB.icc -profile /path/to/USWebCoatedSWOP.icc output_cmyk.jpgNote: If the input image already has an accurate embedded profile, ImageMagick is smart enough to handle the conversion by only defining the target profile once. However, explicitly defining both ensures consistency if the source image is missing metadata.
Striping Existing Profiles Before Applying New Ones
Sometimes, images contain bloated metadata or corrupted color
profiles. You can clear out existing profiles and metadata using the
-strip command before applying a fresh profile.
magick input.jpg -strip -profile /path/to/sRGB.icc output_clean.jpgVerifying the Color Profile
After running the command, you can verify that the ICC profile was
correctly embedded by using ImageMagickās identify
tool.
magick identify -verbose output.jpg | grep "Properties:" -A 10Look for the icc:description or Profiles
section in the output text to confirm that your target profile (e.g.,
sRGB or AdobeRGB) is listed.