Python Imaging Library (Fork) providing comprehensive image processing capabilities for reading, writing, and manipulating images across dozens of formats.
—
Professional color management with ICC profile support, color space conversions, and rendering intent control for accurate color reproduction across devices and media.
class ImageCmsProfile:
"""ICC color profile representation."""
def __init__(self, profile):
"""
Create profile from file path, bytes, or existing profile.
Parameters:
- profile (str | bytes | ImageCmsProfile): Profile data
"""
def createProfile(colorSpace, colorTemp=None):
"""
Create a standard color profile.
Parameters:
- colorSpace (str): Color space ("sRGB", "LAB", "XYZ", etc.)
- colorTemp (float): Color temperature for illuminant
Returns:
ImageCmsProfile: Created profile
"""
def getProfileName(profile):
"""
Get profile description name.
Parameters:
- profile (ImageCmsProfile): Profile object
Returns:
str: Profile name
"""
def getProfileInfo(profile):
"""
Get detailed profile information.
Parameters:
- profile (ImageCmsProfile): Profile object
Returns:
str: Profile information
"""class ImageCmsTransform:
"""Color transformation object."""
def profileToProfile(im, inputProfile, outputProfile, renderingIntent=0, outputMode=None, inPlace=False, flags=0):
"""
Transform image between color profiles.
Parameters:
- im (Image): Input image
- inputProfile (ImageCmsProfile | str): Input color profile
- outputProfile (ImageCmsProfile | str): Output color profile
- renderingIntent (int): Rendering intent (0=perceptual, 1=relative, 2=saturation, 3=absolute)
- outputMode (str): Output image mode
- inPlace (bool): Modify image in place
- flags (int): Transformation flags
Returns:
Image: Color-transformed image
"""
def buildTransform(inputProfile, outputProfile, inMode, outMode, renderingIntent=0, flags=0):
"""
Build reusable color transform object.
Parameters:
- inputProfile (ImageCmsProfile): Input profile
- outputProfile (ImageCmsProfile): Output profile
- inMode (str): Input image mode
- outMode (str): Output image mode
- renderingIntent (int): Rendering intent
- flags (int): Transform flags
Returns:
ImageCmsTransform: Transform object
"""
def applyTransform(im, transform, inPlace=False):
"""
Apply color transform to image.
Parameters:
- im (Image): Input image
- transform (ImageCmsTransform): Transform object
- inPlace (bool): Modify image in place
Returns:
Image: Transformed image
"""INTENT_PERCEPTUAL: int = 0
INTENT_RELATIVE_COLORIMETRIC: int = 1
INTENT_SATURATION: int = 2
INTENT_ABSOLUTE_COLORIMETRIC: int = 3from PIL import Image, ImageCms
# Load image and convert from sRGB to Adobe RGB
img = Image.open("photo.jpg")
srgb_profile = ImageCms.createProfile("sRGB")
adobe_profile = ImageCms.createProfile("ADOBE_RGB")
converted = ImageCms.profileToProfile(img, srgb_profile, adobe_profile)
converted.save("adobe_rgb_photo.jpg")Install with Tessl CLI
npx tessl i tessl/pypi-pillow