Color Profile Management

This section covers Image Transformations (or CDN API methods) that provide color profile management and configure Uploadcare’s CDN behavior depending on the size of ICC profiles embedded in images.

Color Models and ICC Profiles

Digital images can be stored in different color models depending on how we use them: whether it is displaying, printing, or something else. The most common model for images intended for viewing is RGB, while CMYK is widely used for printing.

While CMYK images are common, some browsers support them poorly. But more importantly, CMYK support is inconsistent across different browsers. This means that if you happen to serve CMYK images on your site, the colors will vary.

To eliminate the inconsistency, by default, we convert all CMYK images to sRGB. Another drawback of rendering CMYK images on a page is the large size of CMYK ICC profiles (those weight more than a regular 1920x1080 JPEG image). This negatively affects your page performance metrics such as First Meaningful Paint (FMP) and Time to Interactive (TTI).


/srgb/fast/, 33Kb
CMYK image converted to sRGB.

/srgb/icc/, 33Kb
CMYK image converted to sRGB using ICC profile.

/srgb/keep_profile/, 617Kb
CMYK image with the original ICC profile. Colors depend on a browser.

In turn, an ICC profile defines how we interpret colors for the given color model. ICC profiles are binary files, which can be either embedded in an image or distributed as is.

With RGB images, embedding a profile is optional. If there is no embed, sRGB is assumed as default color space. Since most of the images on the internet are in sRGB, they commonly don’t include any profile embeds. For CMYK images, an embedded ICC profile is mandatory, while still can be absent. In the last case, we assume that the image is in the “Web Coated (SWOP) v2” color space.

Configure Conversion to sRGB, srgb

-/srgb/fast/
-/srgb/icc/
-/srgb/keep_profile/

The operation sets how Uploadcare behaves depending on different color profiles of uploaded images. See the table below to learn more about the possible outcomes. We also provide an option to omit the conversion for the cases where you explicitly want CMYK outputs.

The operation defaults to the fast value. However, we plan to optimize our image processing infrastructure to make icc faster and make it default. Both operations ensure consistently displaying images across different browsers.

Depending on the input color model, the parameter you include in the operation, and threshold you set with max_icc_size, one of the four possible outcomes will occur: profile embedding, profile discarding, color conversion, and fast color conversion.

Input Imagefasticckeep_profile
RGB, small profileembeddingembeddingembedding
RGB, large profilediscardingconversionembedding
CMYK imagefast conversionconversionembedding*

“small profile” and “large profile” stand for profile sizes below and above the max_icc_size setting respectively.

Here is the definition for every possible outcome:

  • Profile embedding: no changes in image model or colors. ICC profile, if present in the source image, stays embedded.
  • Profile discarding: no changes in image model or colors. ICC profile, if present, gets stripped off an image.
  • Color conversion: an image will be converted to sRGB using a full-featured color management system.
  • Fast color conversion is performed using a simple formula which doesn’t consider any color profile and thus provides a result different from a color-managed version.

* While we try to preserve the color model and profile for CMYK images with the -/srgb/keep_profile/ setting, this is not always possible. Certain Image Transformations require RGB color model, and thus we automatically convert the subjected images to sRGB using the icc mode. The list of operations incompatible with CMYK includes: setfill, overlay, enhance, filter, and Color Adjustments.

Setting the ICC Profile Size Threshold, max_icc_size

-/max_icc_size/0/
-/max_icc_size/:number/

The operation defines which RGB color profile sizes will be considered “small” and “large” when using srgb in fast or icc modes. The :number stands for the ICC profile size in kilobytes.

The default value is 10 (10240 bytes). Most of the common RGB profile sizes (sRGB, Display P3, ProPhoto, Adobe RGB, Apple RGB) are below the threshold.


Image with the original
Display P3 color profile. 25Kb.

/max_icc_size/0/-/srgb/fast/
No ICC profile, small color shift. 24.5Kb.

We’re always happy to help with code, integration, and other stuff. Search our site for more info or post your question in our Community Area.