Sub topic 7
Embedding, assigning and converting
This chapter assumes you know what an ICC profile is, what a working space is, and how RGB and CMYK differ as colour modes. Embedding, assigning and converting are three separate actions. Mixing them up causes many colour mismatches.
Three actions, three effects
| Action | Changes the numbers? | Changes the tag? | Changes the appearance? |
|---|---|---|---|
| Embed | No | Saves the existing tag in the file | No |
| Assign | No | Replaces the tag | Yes |
| Convert | Yes | Replaces the tag | No (aims to keep it) |
Embedding stores a profile inside the file when you save. The numbers and the tag stay as they are. Any application that reads the file can then interpret the numbers correctly.
Assigning changes the profile attached to the file without touching the numbers. The same numbers are now read as a different colour. Assign when a file has no profile or the wrong one. For example, a camera file that arrives untagged is probably sRGB, so you assign sRGB.
Converting recalculates the numbers so the colour looks the same in a different profile. The CMM (colour management module) maps the values from the source profile through the profile connection space to the destination profile. Convert when you move to a different working space or to a print condition.
Check before you change
Look at the tag before you decide. This command shows what a file is tagged with:
exiftool -ICC_Profile:ProfileDescription -ICC_Profile:ProfileClass -ICC_Profile:ColorSpaceData photo.jpgIf it prints nothing, the file is untagged. Do not convert an untagged file, because the CMM would have to guess the source.
Converting in code
This script reads the embedded RGB profile and converts to a CMYK press profile. It uses relative colorimetric intent with black point compensation, then saves with the new profile embedded.
import io
from PIL import Image, ImageCms
im = Image.open("photo.jpg")
src = ImageCms.ImageCmsProfile(io.BytesIO(im.info["icc_profile"]))
dst = ImageCms.getOpenProfile("press_profile.icc")
out = ImageCms.profileToProfile(
im,
src,
dst,
renderingIntent=ImageCms.Intent.RELATIVE_COLORIMETRIC,
outputMode="CMYK",
flags=ImageCms.Flags.BLACKPOINTCOMPENSATION,
)
out.save("photo_cmyk.tif", icc_profile=dst.tobytes())The last line matters. If you save the CMYK numbers without the destination profile, the next reader cannot tell which press condition they belong to.
Common errors
- Assigning when you meant to convert. The image shifts in colour, and the file now holds the wrong numbers for its tag.
- Converting when you meant to assign. An untagged file gets converted from the wrong source, and the error is baked into the numbers.
- Converting repeatedly. Each conversion can clip out-of-gamut colours. Keep an RGB master and convert a copy to CMYK once.
- Stripping the profile on export. Some web export options remove it, and viewers then assume sRGB.
Exercise
A client sends an untagged RGB photo that looks dull when you open it, and you know it came from an Adobe RGB camera setting. Should you assign or convert, and to what?
Show answer
Assign Adobe RGB (1998). The numbers are already correct for Adobe RGB, only the tag is missing, so changing the numbers with a conversion would be wrong. Convert afterwards only if your destination needs a different space.