Use Compact Color Profiles to Reduce Image Size
When publishing images to the web, use compact embedded color profiles to reduce image size.
The sRGB v2 ICC profile is about 3 KB in size. Profiles aren’t compressed when embedded in image files, and images usually aren’t sent with any stream compression, so that 3 KB profile becomes 3 KB of wire weight for every image on the page.
Larger profiles exist. Elle Stone’s v2 “Well-Behaved ICC Profiles” are 9 KB. And a few of my own images are tagged with an “Apple Wide Color Sharing Profile” that’s 30 KB!
Instead, use compact profiles that describe the same colorspace in fewer bytes. Technically, Profiles Aren’t Interchangable Even When They Describe the Same Colorspace, but the space savings seem to be worth the trade-off.
Strip sRGB Profiles
Because Modern Browsers Assume Untagged Images and Colors Are sRGB, sRGB profiles can be stripped entirely if supporting older browsers isn’t a priority.11 There may be other metadata to strip too; see Profiles Aren’t the Only Way to Specify an Image’s Colorspace.
Note that Identifying Profiles is Hard.
Prefer v4 Profiles Over v2 Profiles
This post was last updated January 2023. Software changes rapidly, and this note may not be up to date.
v2 profiles encode the tone response curves as a series of points with linear interpolation, requiring many points to describe the curve accurately. For example, the reference sRGB curve is defined by 1,024 points. While you might want this precision in some applications, it’s not really useful when rendering 8-bit images.
v4 profiles can encode parametric curves in less space. Support for v4 profiles was inconsistent a few years ago; this seems to have improved, although I haven’t done a thorough survey.
Compact Profiles
Some folks have developed minimal color profiles specifically for embedding in images published on the web. These profiles minimize header sizes and encode the tone response curves in as few points as possible, while retaining enough accuracy for 8-bit images.
Facebook tags its images with a 524 byte sRGB profile with the description string c2
. Wikimedia uses this profile as well.
Clinton Ingram has released several even more compact profiles under CC0. There are also profiles for other colorspaces, including Display P3 and AdobeRGB.
- Links
- Elle Stone’s Well-Behaved Color Profiles (external link)
- Thumbnails should embed tinyRGB instead of sRGB when they include that ICC profile (Wikimedia Bug) (external link)
- Clinton Ingram’s Compact ICC Profiles (external link)