Overview
ICC (International Color Consortium) profiles define how colors in an image should be interpreted and displayed. When processing images through AI models, the ICC profile is typically lost, potentially changing the image’s color appearance. OpenComic AI Bin can preserve ICC profiles from your source images by integrating with the Sharp image processing library.Why ICC profiles matter
ICC profiles ensure color consistency across different devices and applications:- Without ICC profile: Colors may appear different in various viewers and browsers
- With ICC profile: Colors display consistently according to the embedded color space
- Professional photography workflows
- Print production
- Maintaining color accuracy from scanned materials
- Wide-gamut color spaces (Adobe RGB, ProPhoto RGB, etc.)
Sharp integration
To enable ICC profile preservation, pass a Sharp instance to OpenComic AI:You must install Sharp separately:
npm install sharppipeline will preserve their ICC profiles.
Complete example
pipelineColourspace configuration
ThepipelineColourspace parameter controls how Sharp processes colors internally:
Available colourspaces
'rgb16'(default) - 16-bit RGB, higher precision, better color accuracy'rgb'- 8-bit RGB, faster but may introduce banding in gradients
'rgb16' provides the best balance of quality and performance.
How it works
When ICC profile preservation is enabled:- Before processing, the ICC profile is extracted from the source image
- The image is processed through the AI model(s)
- After processing, the original ICC profile is embedded in the output image
- Sharp applies the profile transformation with the specified
pipelineColourspace
index.mts:1027-1074:
Output format considerations
ICC profiles are embedded differently depending on output format:JPEG
PNG
WebP
The output format is determined by the file extension of the destination path, not the source image.
When to use ICC profile preservation
Enable ICC profile preservation when:- Processing professionally photographed images
- Working with scanned artwork that has been color-corrected
- Preparing images for print production
- Maintaining color accuracy across different display devices
- Working with wide-gamut color spaces (Adobe RGB, ProPhoto RGB)
- Processing standard sRGB images for web use
- Working with images that don’t have embedded profiles
- Performance is critical and color precision is less important
- Source images are already in the target color space
Checking for ICC profiles
You can check if an image has an ICC profile using Sharp:Performance impact
ICC profile preservation adds minimal overhead:- Extracting the ICC profile: ~10-50ms
- Re-encoding with the profile: ~100-500ms (depending on image size)
Example: Batch processing with ICC profiles
Disabling ICC profile preservation
If you need to disable ICC profile preservation after enabling it:keepIccProfile() at all.
Next steps
- Learn about basic usage for fundamental concepts
- Explore pipeline processing to chain multiple operations
- Review model selection to choose the right models