Merge pull request #4735 from nulano/refs-type

This commit is contained in:
Hugo van Kemenade 2020-06-28 09:41:37 +03:00 committed by GitHub
commit 977094d4b5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 79 additions and 106 deletions

View File

@ -273,57 +273,51 @@ Attributes
Instances of the :py:class:`Image` class have the following attributes:
.. py:attribute:: filename
.. py:attribute:: Image.filename
:type: str
The filename or path of the source file. Only images created with the
factory function ``open`` have a filename attribute. If the input is a
file like object, the filename attribute is set to an empty string.
:type: :py:class:`string`
.. py:attribute:: format
.. py:attribute:: Image.format
:type: Optional[str]
The file format of the source file. For images created by the library
itself (via a factory function, or by running a method on an existing
image), this attribute is set to ``None``.
:type: :py:class:`string` or ``None``
.. py:attribute:: mode
.. py:attribute:: Image.mode
:type: str
Image mode. This is a string specifying the pixel format used by the image.
Typical values are “1”, “L”, “RGB”, or “CMYK.” See
:ref:`concept-modes` for a full list.
:type: :py:class:`string`
.. py:attribute:: size
.. py:attribute:: Image.size
:type: tuple[int]
Image size, in pixels. The size is given as a 2-tuple (width, height).
:type: ``(width, height)``
.. py:attribute:: width
.. py:attribute:: Image.width
:type: int
Image width, in pixels.
:type: :py:class:`int`
.. py:attribute:: height
.. py:attribute:: Image.height
:type: int
Image height, in pixels.
:type: :py:class:`int`
.. py:attribute:: palette
.. py:attribute:: Image.palette
:type: Optional[PIL.ImagePalette.ImagePalette]
Colour palette table, if any. If mode is "P" or "PA", this should be an
instance of the :py:class:`~PIL.ImagePalette.ImagePalette` class.
Otherwise, it should be set to ``None``.
:type: :py:class:`~PIL.ImagePalette.ImagePalette` or ``None``
.. py:attribute:: info
.. py:attribute:: Image.info
:type: dict
A dictionary holding data associated with the image. This dictionary is
used by file handlers to pass on various non-image information read from
@ -335,5 +329,3 @@ Instances of the :py:class:`Image` class have the following attributes:
keep a reference to the info dictionary returned from the open method.
Unless noted elsewhere, this dictionary does not affect saving files.
:type: :py:class:`dict`

View File

@ -46,31 +46,30 @@ can be easily displayed in a chromaticity diagram, for example).
.. py:class:: CmsProfile
.. py:attribute:: creation_date
:type: Optional[datetime.datetime]
Date and time this profile was first created (see 7.2.1 of ICC.1:2010).
:type: :py:class:`datetime.datetime` or ``None``
.. py:attribute:: version
:type: float
The version number of the ICC standard that this profile follows
(e.g. ``2.0``).
:type: :py:class:`float`
.. 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).
:type: :py:class:`string`
.. 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
@ -80,9 +79,8 @@ can be easily displayed in a chromaticity diagram, for example).
interpreted (non-padded) variant of this (but can be empty on
unknown input).
:type: :py:class:`string`
.. 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
@ -91,42 +89,37 @@ can be easily displayed in a chromaticity diagram, for example).
Note that the deprecated attribute ``pcs`` contains an interpreted
(non-padded) variant of this (but can be empty on unknown input).
:type: :py:class:`string`
.. py:attribute:: header_flags
:type: int
The encoded header flags of the profile (see 7.2.11 of ICC.1:2010
for details).
:type: :py:class:`int`
.. 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).
:type: :py:class:`string`
.. 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).
:type: :py:class:`string`
.. 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).
:type: :py:class:`int`
.. 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
@ -135,84 +128,82 @@ can be easily displayed in a chromaticity diagram, for example).
One of ``ImageCms.INTENT_ABSOLUTE_COLORIMETRIC``, ``ImageCms.INTENT_PERCEPTUAL``,
``ImageCms.INTENT_RELATIVE_COLORIMETRIC`` and ``ImageCms.INTENT_SATURATION``.
:type: :py:class:`int`
.. 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).
:type: :py:class:`bytes`
.. py:attribute:: copyright
:type: Optional[str]
The text copyright information for the profile (see 9.2.21 of ICC.1:2010).
:type: :py:class:`unicode` or ``None``
.. py:attribute:: manufacturer
:type: Optional[str]
The (English) display string for the device manufacturer (see
9.2.22 of ICC.1:2010).
:type: :py:class:`unicode` or ``None``
.. py:attribute:: model
:type: Optional[str]
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).
:type: :py:class:`unicode` or ``None``
.. py:attribute:: profile_description
:type: Optional[str]
The (English) display string for the profile description (see
9.2.41 of ICC.1:2010).
:type: :py:class:`unicode` or ``None``
.. py:attribute:: target
:type: Optional[str]
The name of the registered characterization data set, or the
measurement data for a characterization target (see 9.2.14 of
ICC.1:2010).
:type: :py:class:`unicode` or ``None``
.. py:attribute:: red_colorant
:type: Optional[tuple[tuple[float]]]
The first column in the matrix used in matrix/TRC transforms (see 9.2.44 of ICC.1:2010).
:type: ``((X, Y, Z), (x, y, Y))`` or ``None``
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: green_colorant
:type: Optional[tuple[tuple[float]]]
The second column in the matrix used in matrix/TRC transforms (see 9.2.30 of ICC.1:2010).
:type: ``((X, Y, Z), (x, y, Y))`` or ``None``
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: blue_colorant
:type: Optional[tuple[tuple[float]]]
The third column in the matrix used in matrix/TRC transforms (see 9.2.4 of ICC.1:2010).
:type: ``((X, Y, Z), (x, y, Y))`` or ``None``
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: luminance
:type: Optional[tuple[tuple[float]]]
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).
:type: ``((X, Y, Z), (x, y, Y))`` or ``None``
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: chromaticity
:type: Optional[tuple[tuple[float]]]
The data of the phosphor/colorant chromaticity set used (red,
green and blue channels, see 9.2.16 of ICC.1:2010).
:type: ``((x, y, Y), (x, y, Y), (x, y, Y))`` or ``None``
The value is in the format ``((x, y, Y), (x, y, Y), (x, y, Y))``, if available.
.. py:attribute:: chromatic_adaption
:type: tuple[tuple[float]]
The chromatic adaption matrix converts a color measured using the
actual illumination conditions and relative to the actual adopted
@ -220,58 +211,52 @@ can be easily displayed in a chromaticity diagram, for example).
complete adaptation from the actual adopted white chromaticity to
the PCS adopted white chromaticity (see 9.2.15 of ICC.1:2010).
Two matrices are returned, one in (X, Y, Z) space and one in (x, y, Y) space.
:type: 2-tuple of 3-tuple, the first with (X, Y, Z) and the second with (x, y, Y) values
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).
:type: list of strings
.. 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).
:type: list of strings
.. py:attribute:: colorimetric_intent
:type: Optional[str]
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).
:type: :py:class:`string` or ``None``
.. py:attribute:: perceptual_rendering_intent_gamut
:type: Optional[str]
4-character string (padded with whitespace) identifying the (one)
standard reference medium gamut (see 9.2.37 of ICC.1:2010 for
details).
:type: :py:class:`string` or ``None``
.. py:attribute:: saturation_rendering_intent_gamut
:type: Optional[str]
4-character string (padded with whitespace) identifying the (one)
standard reference medium gamut (see 9.2.37 of ICC.1:2010 for
details).
:type: :py:class:`string` or ``None``
.. py:attribute:: technology
:type: Optional[str]
4-character string (padded with whitespace) identifying the device
technology (see 9.2.47 of ICC.1:2010 for details).
:type: :py:class:`string` or ``None``
.. py:attribute:: media_black_point
:type: Optional[tuple[tuple[float]]]
This tag specifies the media black point and is used for
generating absolute colorimetry.
@ -279,57 +264,57 @@ can be easily displayed in a chromaticity diagram, for example).
This tag was available in ICC 3.2, but it is removed from
version 4.
:type: ``((X, Y, Z), (x, y, Y))`` or ``None``
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: media_white_point_temperature
:type: Optional[float]
Calculates the white point temperature (see the LCMS documentation
for more information).
:type: :py:class:`float` or ``None``
.. py:attribute:: viewing_condition
:type: Optional[str]
The (English) display string for the viewing conditions (see
9.2.48 of ICC.1:2010).
:type: :py:class:`unicode` or ``None``
.. py:attribute:: screening_description
:type: Optional[str]
The (English) display string for the screening conditions.
This tag was available in ICC 3.2, but it is removed from
version 4.
:type: :py:class:`unicode` or ``None``
.. py:attribute:: red_primary
:type: Optional[tuple[tuple[float]]]
The XYZ-transformed of the RGB primary color red (1, 0, 0).
:type: ``((X, Y, Z), (x, y, Y))`` or ``None``
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: green_primary
:type: Optional[tuple[tuple[float]]]
The XYZ-transformed of the RGB primary color green (0, 1, 0).
:type: ``((X, Y, Z), (x, y, Y))`` or ``None``
The value is in the format ``((X, Y, Z), (x, y, Y))``, if available.
.. py:attribute:: blue_primary
:type: Optional[tuple[tuple[float]]]
The XYZ-transformed of the RGB primary color blue (0, 0, 1).
:type: ``((X, Y, Z), (x, y, Y))`` or ``None``
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).
:type: :py:class:`bool`
.. py:attribute:: clut
:type: dict[tuple[bool]]
Returns a dictionary of all supported intents and directions for
the CLUT model.
@ -347,9 +332,8 @@ can be easily displayed in a chromaticity diagram, for example).
The elements of the tuple are booleans. If the value is ``True``,
that intent is supported for that direction.
:type: :py:class:`dict` of boolean 3-tuples
.. py:attribute:: intent_supported
:type: dict[tuple[bool]]
Returns a dictionary of all supported intents and directions.
@ -366,53 +350,46 @@ can be easily displayed in a chromaticity diagram, for example).
The elements of the tuple are booleans. If the value is ``True``,
that intent is supported for that direction.
:type: :py:class:`dict` of boolean 3-tuples
.. py:attribute:: color_space
:type: str
Deprecated but retained for backwards compatibility.
Interpreted value of :py:attr:`.xcolor_space`. May be the
empty string if value could not be decoded.
:type: :py:class:`string`
.. py:attribute:: pcs
:type: str
Deprecated but retained for backwards compatibility.
Interpreted value of :py:attr:`.connection_space`. May be
the empty string if value could not be decoded.
:type: :py:class:`string`
.. py:attribute:: product_model
:type: str
Deprecated but retained for backwards compatibility.
ASCII-encoded value of :py:attr:`.model`.
:type: :py:class:`string`
.. py:attribute:: product_manufacturer
:type: str
Deprecated but retained for backwards compatibility.
ASCII-encoded value of :py:attr:`.manufacturer`.
:type: :py:class:`string`
.. py:attribute:: product_copyright
:type: str
Deprecated but retained for backwards compatibility.
ASCII-encoded value of :py:attr:`.copyright`.
:type: :py:class:`string`
.. py:attribute:: product_description
:type: str
Deprecated but retained for backwards compatibility.
ASCII-encoded value of :py:attr:`.profile_description`.
:type: :py:class:`string`
.. py:attribute:: product_desc
:type: str
Deprecated but retained for backwards compatibility.
ASCII-encoded value of :py:attr:`.profile_description`.
@ -422,8 +399,6 @@ can be easily displayed in a chromaticity diagram, for example).
depending on the value of the description, copyright,
manufacturer and model fields).
:type: :py:class:`string`
There is one function defined on the class:
.. py:method:: is_intent_supported(intent, direction)

View File

@ -98,20 +98,24 @@ These functions are applied to each individual pixel.
.. py:currentmodule:: None
.. py:function:: abs(image)
:noindex:
Absolute value.
.. py:function:: convert(image, mode)
:noindex:
Convert image to the given mode. The mode must be given as a string
constant.
.. py:function:: float(image)
:noindex:
Convert image to 32-bit floating point. This is equivalent to
convert(image, “F”).
.. py:function:: int(image)
:noindex:
Convert image to 32-bit integer. This is equivalent to convert(image, “I”).
@ -119,9 +123,11 @@ These functions are applied to each individual pixel.
integers if necessary to get a correct result.
.. py:function:: max(image1, image2)
:noindex:
Maximum value.
.. py:function:: min(image1, image2)
:noindex:
Minimum value.