1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
|
.. py:module:: PIL.ImageCms
.. py:currentmodule:: PIL.ImageCms
:py:mod:`~PIL.ImageCms` module
==============================
The :py:mod:`~PIL.ImageCms` module provides color profile management
support using the LittleCMS2 color management engine, based on Kevin
Cazabon's PyCMS library.
.. autoclass:: ImageCmsProfile
:members:
:special-members: __init__
.. autoclass:: ImageCmsTransform
:members:
:undoc-members:
:show-inheritance:
.. autoexception:: PyCMSError
Constants
---------
.. autoclass:: Intent
:members:
:member-order: bysource
:undoc-members:
:show-inheritance:
.. autoclass:: Direction
:members:
:member-order: bysource
:undoc-members:
:show-inheritance:
.. autoclass:: Flags
:members:
:member-order: bysource
:undoc-members:
:show-inheritance:
Functions
---------
.. autofunction:: applyTransform
.. autofunction:: buildProofTransform
.. autofunction:: buildProofTransformFromOpenProfiles
.. autofunction:: buildTransform
.. autofunction:: buildTransformFromOpenProfiles
.. autofunction:: createProfile
.. autofunction:: getDefaultIntent
.. autofunction:: getOpenProfile
.. autofunction:: getProfileCopyright
.. autofunction:: getProfileDescription
.. autofunction:: getProfileInfo
.. autofunction:: getProfileManufacturer
.. autofunction:: getProfileModel
.. autofunction:: getProfileName
.. autofunction:: get_display_profile
.. autofunction:: isIntentSupported
.. autofunction:: profileToProfile
CmsProfile
----------
The ICC color profiles are wrapped in an instance of the class
:py:class:`~core.CmsProfile`. The specification ICC.1:2010 contains more
information about the meaning of the values in ICC profiles.
For convenience, all XYZ-values are also given as xyY-values (so they
can be easily displayed in a chromaticity diagram, for example).
.. py:currentmodule:: PIL.ImageCms.core
.. py:class:: CmsProfile
:canonical: PIL._imagingcms.CmsProfile
.. py:attribute:: creation_date
:type: datetime.datetime | None
Date and time this profile was first created (see 7.2.1 of ICC.1:2010).
.. py:attribute:: version
:type: float
The version number of the ICC standard that this profile follows
(e.g. ``2.0``).
.. py:attribute:: icc_version
:type: int
Same as ``version``, but in encoded format (see 7.2.4 of ICC.1:2010).
.. py:attribute:: device_class
:type: str
4-character string identifying the profile class. One of
``scnr``, ``mntr``, ``prtr``, ``link``, ``spac``, ``abst``,
``nmcl`` (see 7.2.5 of ICC.1:2010 for details).
.. py:attribute:: xcolor_space
:type: str
4-character string (padded with whitespace) identifying the color
space, e.g. ``XYZ␣``, ``RGB␣`` or ``CMYK`` (see 7.2.6 of
ICC.1:2010 for details).
.. py:attribute:: connection_space
:type: str
4-character string (padded with whitespace) identifying the color
space on the B-side of the transform (see 7.2.7 of ICC.1:2010 for
details).
.. py:attribute:: header_flags
:type: int
The encoded header flags of the profile (see 7.2.11 of ICC.1:2010
for details).
.. py:attribute:: header_manufacturer
:type: str
4-character string (padded with whitespace) identifying the device
manufacturer, which shall match the signature contained in the
appropriate section of the ICC signature registry found at
www.color.org (see 7.2.12 of ICC.1:2010).
.. py:attribute:: header_model
:type: str
4-character string (padded with whitespace) identifying the device
model, which shall match the signature contained in the
appropriate section of the ICC signature registry found at
www.color.org (see 7.2.13 of ICC.1:2010).
.. py:attribute:: attributes
:type: int
Flags used to identify attributes unique to the particular device
setup for which the profile is applicable (see 7.2.14 of
ICC.1:2010 for details).
.. py:attribute:: rendering_intent
:type: int
The rendering intent to use when combining this profile with
another profile (usually overridden at run-time, but provided here
for DeviceLink and embedded source profiles, see 7.2.15 of ICC.1:2010).
One of ``ImageCms.Intent.ABSOLUTE_COLORIMETRIC``, ``ImageCms.Intent.PERCEPTUAL``,
``ImageCms.Intent.RELATIVE_COLORIMETRIC`` and ``ImageCms.Intent.SATURATION``.
.. py:attribute:: profile_id
:type: bytes
A sequence of 16 bytes identifying the profile (via a specially
constructed MD5 sum), or 16 binary zeroes if the profile ID has
not been calculated (see 7.2.18 of ICC.1:2010).
.. py:attribute:: copyright
:type: str | None
The text copyright information for the profile (see 9.2.21 of ICC.1:2010).
.. py:attribute:: manufacturer
:type: str | None
The (English) display string for the device manufacturer (see
9.2.22 of ICC.1:2010).
.. py:attribute:: model
:type: str | None
The (English) display string for the device model of the device
for which this profile is created (see 9.2.23 of ICC.1:2010).
.. py:attribute:: profile_description
:type: str | None
The (English) display string for the profile description (see
9.2.41 of ICC.1:2010).
.. py:attribute:: target
:type: str | None
The name of the registered characterization data set, or the
measurement data for a characterization target (see 9.2.14 of
ICC.1:2010).
.. py:attribute:: red_colorant
:type: tuple[tuple[float, float, float], tuple[float, float, float]] | None
The first column in the matrix used in matrix/TRC transforms (see 9.2.44 of ICC.1:2010).
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: green_colorant
:type: tuple[tuple[float, float, float], tuple[float, float, float]] | None
The second column in the matrix used in matrix/TRC transforms (see 9.2.30 of ICC.1:2010).
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: blue_colorant
:type: tuple[tuple[float, float, float], tuple[float, float, float]] | None
The third column in the matrix used in matrix/TRC transforms (see 9.2.4 of ICC.1:2010).
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: luminance
:type: tuple[tuple[float, float, float], tuple[float, float, float]] | None
The absolute luminance of emissive devices in candelas per square
metre as described by the Y channel (see 9.2.32 of ICC.1:2010).
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: chromaticity
:type: tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]] | None
The data of the phosphor/colorant chromaticity set used (red,
green and blue channels, see 9.2.16 of ICC.1:2010).
The value is in the format ``((x, y, Y), (x, y, Y), (x, y, Y))``, if available.
.. py:attribute:: chromatic_adaption
:type: tuple[tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]], tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]]] | None
The chromatic adaption matrix converts a color measured using the
actual illumination conditions and relative to the actual adopted
white, to a color relative to the PCS adopted white, with
complete adaptation from the actual adopted white chromaticity to
the PCS adopted white chromaticity (see 9.2.15 of ICC.1:2010).
Two 3-tuples of floats are returned in a 2-tuple,
one in (X, Y, Z) space and one in (x, y, Y) space.
.. py:attribute:: colorant_table
:type: list[str]
This tag identifies the colorants used in the profile by a unique
name and set of PCSXYZ or PCSLAB values (see 9.2.19 of
ICC.1:2010).
.. py:attribute:: colorant_table_out
:type: list[str]
This tag identifies the colorants used in the profile by a unique
name and set of PCSLAB values (for DeviceLink profiles only, see
9.2.19 of ICC.1:2010).
.. py:attribute:: colorimetric_intent
:type: str | None
4-character string (padded with whitespace) identifying the image
state of PCS colorimetry produced using the colorimetric intent
transforms (see 9.2.20 of ICC.1:2010 for details).
.. py:attribute:: perceptual_rendering_intent_gamut
:type: str | None
4-character string (padded with whitespace) identifying the (one)
standard reference medium gamut (see 9.2.37 of ICC.1:2010 for
details).
.. py:attribute:: saturation_rendering_intent_gamut
:type: str | None
4-character string (padded with whitespace) identifying the (one)
standard reference medium gamut (see 9.2.37 of ICC.1:2010 for
details).
.. py:attribute:: technology
:type: str | None
4-character string (padded with whitespace) identifying the device
technology (see 9.2.47 of ICC.1:2010 for details).
.. py:attribute:: media_black_point
:type: tuple[tuple[float, float, float], tuple[float, float, float]] | None
This tag specifies the media black point and is used for
generating absolute colorimetry.
This tag was available in ICC 3.2, but it is removed from
version 4.
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: media_white_point
:type: tuple[tuple[float, float, float], tuple[float, float, float]] | None
This tag specifies the media white point and is used for
generating absolute colorimetry.
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: media_white_point_temperature
:type: float | None
Calculates the white point temperature (see the LCMS documentation
for more information).
.. py:attribute:: viewing_condition
:type: str | None
The (English) display string for the viewing conditions (see
9.2.48 of ICC.1:2010).
.. py:attribute:: screening_description
:type: str | None
The (English) display string for the screening conditions.
This tag was available in ICC 3.2, but it is removed from
version 4.
.. py:attribute:: red_primary
:type: tuple[tuple[float, float, float], tuple[float, float, float]] | None
The XYZ-transformed of the RGB primary color red (1, 0, 0).
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: green_primary
:type: tuple[tuple[float, float, float], tuple[float, float, float]] | None
The XYZ-transformed of the RGB primary color green (0, 1, 0).
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: blue_primary
:type: tuple[tuple[float, float, float], tuple[float, float, float]] | None
The XYZ-transformed of the RGB primary color blue (0, 0, 1).
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: is_matrix_shaper
:type: bool
True if this profile is implemented as a matrix shaper (see
documentation on LCMS).
.. py:attribute:: clut
:type: dict[int, tuple[bool, bool, bool]] | None
Returns a dictionary of all supported intents and directions for
the CLUT model.
The dictionary is indexed by intents
(``ImageCms.Intent.ABSOLUTE_COLORIMETRIC``,
``ImageCms.Intent.PERCEPTUAL``,
``ImageCms.Intent.RELATIVE_COLORIMETRIC`` and
``ImageCms.Intent.SATURATION``).
The values are 3-tuples indexed by directions
(``ImageCms.Direction.INPUT``, ``ImageCms.Direction.OUTPUT``,
``ImageCms.Direction.PROOF``).
The elements of the tuple are booleans. If the value is ``True``,
that intent is supported for that direction.
.. py:attribute:: intent_supported
:type: dict[int, tuple[bool, bool, bool]] | None
Returns a dictionary of all supported intents and directions.
The dictionary is indexed by intents
(``ImageCms.Intent.ABSOLUTE_COLORIMETRIC``,
``ImageCms.Intent.PERCEPTUAL``,
``ImageCms.Intent.RELATIVE_COLORIMETRIC`` and
``ImageCms.Intent.SATURATION``).
The values are 3-tuples indexed by directions
(``ImageCms.Direction.INPUT``, ``ImageCms.Direction.OUTPUT``,
``ImageCms.Direction.PROOF``).
The elements of the tuple are booleans. If the value is ``True``,
that intent is supported for that direction.
There is one function defined on the class:
.. py:method:: is_intent_supported(intent: int, direction: int, /)
Returns if the intent is supported for the given direction.
Note that you can also get this information for all intents and directions
with :py:attr:`.intent_supported`.
:param intent: One of ``ImageCms.Intent.ABSOLUTE_COLORIMETRIC``,
``ImageCms.Intent.PERCEPTUAL``,
``ImageCms.Intent.RELATIVE_COLORIMETRIC``
and ``ImageCms.Intent.SATURATION``.
:param direction: One of ``ImageCms.Direction.INPUT``,
``ImageCms.Direction.OUTPUT``
and ``ImageCms.Direction.PROOF``
:return: Boolean if the intent and direction is supported.
|