or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

color-management.mdcolor-utilities.mdcore-image.mddrawing.mdenhancement.mdfilters.mdfonts.mdimage-sequences.mdimage-statistics.mdindex.mdmath-operations.mdoperations.md

color-management.mddocs/

0

# Color Management

1

2

Professional color management with ICC profile support, color space conversions, and rendering intent control for accurate color reproduction across devices and media.

3

4

## Capabilities

5

6

### Profile Management

7

8

```python { .api }

9

class ImageCmsProfile:

10

"""ICC color profile representation."""

11

12

def __init__(self, profile):

13

"""

14

Create profile from file path, bytes, or existing profile.

15

16

Parameters:

17

- profile (str | bytes | ImageCmsProfile): Profile data

18

"""

19

20

def createProfile(colorSpace, colorTemp=None):

21

"""

22

Create a standard color profile.

23

24

Parameters:

25

- colorSpace (str): Color space ("sRGB", "LAB", "XYZ", etc.)

26

- colorTemp (float): Color temperature for illuminant

27

28

Returns:

29

ImageCmsProfile: Created profile

30

"""

31

32

def getProfileName(profile):

33

"""

34

Get profile description name.

35

36

Parameters:

37

- profile (ImageCmsProfile): Profile object

38

39

Returns:

40

str: Profile name

41

"""

42

43

def getProfileInfo(profile):

44

"""

45

Get detailed profile information.

46

47

Parameters:

48

- profile (ImageCmsProfile): Profile object

49

50

Returns:

51

str: Profile information

52

"""

53

```

54

55

### Color Transformations

56

57

```python { .api }

58

class ImageCmsTransform:

59

"""Color transformation object."""

60

61

def profileToProfile(im, inputProfile, outputProfile, renderingIntent=0, outputMode=None, inPlace=False, flags=0):

62

"""

63

Transform image between color profiles.

64

65

Parameters:

66

- im (Image): Input image

67

- inputProfile (ImageCmsProfile | str): Input color profile

68

- outputProfile (ImageCmsProfile | str): Output color profile

69

- renderingIntent (int): Rendering intent (0=perceptual, 1=relative, 2=saturation, 3=absolute)

70

- outputMode (str): Output image mode

71

- inPlace (bool): Modify image in place

72

- flags (int): Transformation flags

73

74

Returns:

75

Image: Color-transformed image

76

"""

77

78

def buildTransform(inputProfile, outputProfile, inMode, outMode, renderingIntent=0, flags=0):

79

"""

80

Build reusable color transform object.

81

82

Parameters:

83

- inputProfile (ImageCmsProfile): Input profile

84

- outputProfile (ImageCmsProfile): Output profile

85

- inMode (str): Input image mode

86

- outMode (str): Output image mode

87

- renderingIntent (int): Rendering intent

88

- flags (int): Transform flags

89

90

Returns:

91

ImageCmsTransform: Transform object

92

"""

93

94

def applyTransform(im, transform, inPlace=False):

95

"""

96

Apply color transform to image.

97

98

Parameters:

99

- im (Image): Input image

100

- transform (ImageCmsTransform): Transform object

101

- inPlace (bool): Modify image in place

102

103

Returns:

104

Image: Transformed image

105

"""

106

```

107

108

### Constants

109

110

```python { .api }

111

INTENT_PERCEPTUAL: int = 0

112

INTENT_RELATIVE_COLORIMETRIC: int = 1

113

INTENT_SATURATION: int = 2

114

INTENT_ABSOLUTE_COLORIMETRIC: int = 3

115

```

116

117

## Usage Examples

118

119

### Basic Color Space Conversion

120

121

```python

122

from PIL import Image, ImageCms

123

124

# Load image and convert from sRGB to Adobe RGB

125

img = Image.open("photo.jpg")

126

srgb_profile = ImageCms.createProfile("sRGB")

127

adobe_profile = ImageCms.createProfile("ADOBE_RGB")

128

129

converted = ImageCms.profileToProfile(img, srgb_profile, adobe_profile)

130

converted.save("adobe_rgb_photo.jpg")

131

```