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: 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 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 factory function ``open`` have a filename attribute. If the input is a
file like object, the filename attribute is set to an empty string. file like object, the filename attribute is set to an empty string.
:type: :py:class:`string` .. py:attribute:: Image.format
:type: Optional[str]
.. py:attribute:: format
The file format of the source file. For images created by the library 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 itself (via a factory function, or by running a method on an existing
image), this attribute is set to ``None``. image), this attribute is set to ``None``.
:type: :py:class:`string` or ``None`` .. py:attribute:: Image.mode
:type: str
.. py:attribute:: mode
Image mode. This is a string specifying the pixel format used by the image. Image mode. This is a string specifying the pixel format used by the image.
Typical values are “1”, “L”, “RGB”, or “CMYK.” See Typical values are “1”, “L”, “RGB”, or “CMYK.” See
:ref:`concept-modes` for a full list. :ref:`concept-modes` for a full list.
:type: :py:class:`string` .. py:attribute:: Image.size
:type: tuple[int]
.. py:attribute:: size
Image size, in pixels. The size is given as a 2-tuple (width, height). Image size, in pixels. The size is given as a 2-tuple (width, height).
:type: ``(width, height)`` .. py:attribute:: Image.width
:type: int
.. py:attribute:: width
Image width, in pixels. Image width, in pixels.
:type: :py:class:`int` .. py:attribute:: Image.height
:type: int
.. py:attribute:: height
Image height, in pixels. Image height, in pixels.
:type: :py:class:`int` .. py:attribute:: Image.palette
:type: Optional[PIL.ImagePalette.ImagePalette]
.. py:attribute:: palette
Colour palette table, if any. If mode is "P" or "PA", this should be an Colour palette table, if any. If mode is "P" or "PA", this should be an
instance of the :py:class:`~PIL.ImagePalette.ImagePalette` class. instance of the :py:class:`~PIL.ImagePalette.ImagePalette` class.
Otherwise, it should be set to ``None``. Otherwise, it should be set to ``None``.
:type: :py:class:`~PIL.ImagePalette.ImagePalette` or ``None`` .. py:attribute:: Image.info
:type: dict
.. py:attribute:: info
A dictionary holding data associated with the image. This dictionary is A dictionary holding data associated with the image. This dictionary is
used by file handlers to pass on various non-image information read from 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. keep a reference to the info dictionary returned from the open method.
Unless noted elsewhere, this dictionary does not affect saving files. 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:class:: CmsProfile
.. py:attribute:: creation_date .. py:attribute:: creation_date
:type: Optional[datetime.datetime]
Date and time this profile was first created (see 7.2.1 of ICC.1:2010). 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 .. py:attribute:: version
:type: float
The version number of the ICC standard that this profile follows The version number of the ICC standard that this profile follows
(e.g. ``2.0``). (e.g. ``2.0``).
:type: :py:class:`float`
.. py:attribute:: icc_version .. py:attribute:: icc_version
:type: int
Same as ``version``, but in encoded format (see 7.2.4 of ICC.1:2010). Same as ``version``, but in encoded format (see 7.2.4 of ICC.1:2010).
.. py:attribute:: device_class .. py:attribute:: device_class
:type: str
4-character string identifying the profile class. One of 4-character string identifying the profile class. One of
``scnr``, ``mntr``, ``prtr``, ``link``, ``spac``, ``abst``, ``scnr``, ``mntr``, ``prtr``, ``link``, ``spac``, ``abst``,
``nmcl`` (see 7.2.5 of ICC.1:2010 for details). ``nmcl`` (see 7.2.5 of ICC.1:2010 for details).
:type: :py:class:`string`
.. py:attribute:: xcolor_space .. py:attribute:: xcolor_space
:type: str
4-character string (padded with whitespace) identifying the color 4-character string (padded with whitespace) identifying the color
space, e.g. ``XYZ␣``, ``RGB␣`` or ``CMYK`` (see 7.2.6 of 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 interpreted (non-padded) variant of this (but can be empty on
unknown input). unknown input).
:type: :py:class:`string`
.. py:attribute:: connection_space .. py:attribute:: connection_space
:type: str
4-character string (padded with whitespace) identifying the color 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 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 Note that the deprecated attribute ``pcs`` contains an interpreted
(non-padded) variant of this (but can be empty on unknown input). (non-padded) variant of this (but can be empty on unknown input).
:type: :py:class:`string`
.. py:attribute:: header_flags .. py:attribute:: header_flags
:type: int
The encoded header flags of the profile (see 7.2.11 of ICC.1:2010 The encoded header flags of the profile (see 7.2.11 of ICC.1:2010
for details). for details).
:type: :py:class:`int`
.. py:attribute:: header_manufacturer .. py:attribute:: header_manufacturer
:type: str
4-character string (padded with whitespace) identifying the device 4-character string (padded with whitespace) identifying the device
manufacturer, which shall match the signature contained in the manufacturer, which shall match the signature contained in the
appropriate section of the ICC signature registry found at appropriate section of the ICC signature registry found at
www.color.org (see 7.2.12 of ICC.1:2010). www.color.org (see 7.2.12 of ICC.1:2010).
:type: :py:class:`string`
.. py:attribute:: header_model .. py:attribute:: header_model
:type: str
4-character string (padded with whitespace) identifying the device 4-character string (padded with whitespace) identifying the device
model, which shall match the signature contained in the model, which shall match the signature contained in the
appropriate section of the ICC signature registry found at appropriate section of the ICC signature registry found at
www.color.org (see 7.2.13 of ICC.1:2010). www.color.org (see 7.2.13 of ICC.1:2010).
:type: :py:class:`string`
.. py:attribute:: attributes .. py:attribute:: attributes
:type: int
Flags used to identify attributes unique to the particular device Flags used to identify attributes unique to the particular device
setup for which the profile is applicable (see 7.2.14 of setup for which the profile is applicable (see 7.2.14 of
ICC.1:2010 for details). ICC.1:2010 for details).
:type: :py:class:`int`
.. py:attribute:: rendering_intent .. py:attribute:: rendering_intent
:type: int
The rendering intent to use when combining this profile with The rendering intent to use when combining this profile with
another profile (usually overridden at run-time, but provided here 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``, One of ``ImageCms.INTENT_ABSOLUTE_COLORIMETRIC``, ``ImageCms.INTENT_PERCEPTUAL``,
``ImageCms.INTENT_RELATIVE_COLORIMETRIC`` and ``ImageCms.INTENT_SATURATION``. ``ImageCms.INTENT_RELATIVE_COLORIMETRIC`` and ``ImageCms.INTENT_SATURATION``.
:type: :py:class:`int`
.. py:attribute:: profile_id .. py:attribute:: profile_id
:type: bytes
A sequence of 16 bytes identifying the profile (via a specially A sequence of 16 bytes identifying the profile (via a specially
constructed MD5 sum), or 16 binary zeroes if the profile ID has constructed MD5 sum), or 16 binary zeroes if the profile ID has
not been calculated (see 7.2.18 of ICC.1:2010). not been calculated (see 7.2.18 of ICC.1:2010).
:type: :py:class:`bytes`
.. py:attribute:: copyright .. py:attribute:: copyright
:type: Optional[str]
The text copyright information for the profile (see 9.2.21 of ICC.1:2010). The text copyright information for the profile (see 9.2.21 of ICC.1:2010).
:type: :py:class:`unicode` or ``None``
.. py:attribute:: manufacturer .. py:attribute:: manufacturer
:type: Optional[str]
The (English) display string for the device manufacturer (see The (English) display string for the device manufacturer (see
9.2.22 of ICC.1:2010). 9.2.22 of ICC.1:2010).
:type: :py:class:`unicode` or ``None``
.. py:attribute:: model .. py:attribute:: model
:type: Optional[str]
The (English) display string for the device model of the device 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). for which this profile is created (see 9.2.23 of ICC.1:2010).
:type: :py:class:`unicode` or ``None``
.. py:attribute:: profile_description .. py:attribute:: profile_description
:type: Optional[str]
The (English) display string for the profile description (see The (English) display string for the profile description (see
9.2.41 of ICC.1:2010). 9.2.41 of ICC.1:2010).
:type: :py:class:`unicode` or ``None``
.. py:attribute:: target .. py:attribute:: target
:type: Optional[str]
The name of the registered characterization data set, or the The name of the registered characterization data set, or the
measurement data for a characterization target (see 9.2.14 of measurement data for a characterization target (see 9.2.14 of
ICC.1:2010). ICC.1:2010).
:type: :py:class:`unicode` or ``None``
.. py:attribute:: red_colorant .. 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). 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 .. 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). 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 .. 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). 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 .. py:attribute:: luminance
:type: Optional[tuple[tuple[float]]]
The absolute luminance of emissive devices in candelas per square 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). 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 .. py:attribute:: chromaticity
:type: Optional[tuple[tuple[float]]]
The data of the phosphor/colorant chromaticity set used (red, The data of the phosphor/colorant chromaticity set used (red,
green and blue channels, see 9.2.16 of ICC.1:2010). 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 .. py:attribute:: chromatic_adaption
:type: tuple[tuple[float]]
The chromatic adaption matrix converts a color measured using the The chromatic adaption matrix converts a color measured using the
actual illumination conditions and relative to the actual adopted 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 complete adaptation from the actual adopted white chromaticity to
the PCS adopted white chromaticity (see 9.2.15 of ICC.1:2010). 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. Two 3-tuples of floats are returned in a 2-tuple,
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
.. py:attribute:: colorant_table .. py:attribute:: colorant_table
:type: list[str]
This tag identifies the colorants used in the profile by a unique 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 name and set of PCSXYZ or PCSLAB values (see 9.2.19 of
ICC.1:2010). ICC.1:2010).
:type: list of strings
.. py:attribute:: colorant_table_out .. py:attribute:: colorant_table_out
:type: list[str]
This tag identifies the colorants used in the profile by a unique This tag identifies the colorants used in the profile by a unique
name and set of PCSLAB values (for DeviceLink profiles only, see name and set of PCSLAB values (for DeviceLink profiles only, see
9.2.19 of ICC.1:2010). 9.2.19 of ICC.1:2010).
:type: list of strings
.. py:attribute:: colorimetric_intent .. py:attribute:: colorimetric_intent
:type: Optional[str]
4-character string (padded with whitespace) identifying the image 4-character string (padded with whitespace) identifying the image
state of PCS colorimetry produced using the colorimetric intent state of PCS colorimetry produced using the colorimetric intent
transforms (see 9.2.20 of ICC.1:2010 for details). transforms (see 9.2.20 of ICC.1:2010 for details).
:type: :py:class:`string` or ``None``
.. py:attribute:: perceptual_rendering_intent_gamut .. py:attribute:: perceptual_rendering_intent_gamut
:type: Optional[str]
4-character string (padded with whitespace) identifying the (one) 4-character string (padded with whitespace) identifying the (one)
standard reference medium gamut (see 9.2.37 of ICC.1:2010 for standard reference medium gamut (see 9.2.37 of ICC.1:2010 for
details). details).
:type: :py:class:`string` or ``None``
.. py:attribute:: saturation_rendering_intent_gamut .. py:attribute:: saturation_rendering_intent_gamut
:type: Optional[str]
4-character string (padded with whitespace) identifying the (one) 4-character string (padded with whitespace) identifying the (one)
standard reference medium gamut (see 9.2.37 of ICC.1:2010 for standard reference medium gamut (see 9.2.37 of ICC.1:2010 for
details). details).
:type: :py:class:`string` or ``None``
.. py:attribute:: technology .. py:attribute:: technology
:type: Optional[str]
4-character string (padded with whitespace) identifying the device 4-character string (padded with whitespace) identifying the device
technology (see 9.2.47 of ICC.1:2010 for details). technology (see 9.2.47 of ICC.1:2010 for details).
:type: :py:class:`string` or ``None``
.. py:attribute:: media_black_point .. py:attribute:: media_black_point
:type: Optional[tuple[tuple[float]]]
This tag specifies the media black point and is used for This tag specifies the media black point and is used for
generating absolute colorimetry. 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 This tag was available in ICC 3.2, but it is removed from
version 4. 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 .. py:attribute:: media_white_point_temperature
:type: Optional[float]
Calculates the white point temperature (see the LCMS documentation Calculates the white point temperature (see the LCMS documentation
for more information). for more information).
:type: :py:class:`float` or ``None``
.. py:attribute:: viewing_condition .. py:attribute:: viewing_condition
:type: Optional[str]
The (English) display string for the viewing conditions (see The (English) display string for the viewing conditions (see
9.2.48 of ICC.1:2010). 9.2.48 of ICC.1:2010).
:type: :py:class:`unicode` or ``None``
.. py:attribute:: screening_description .. py:attribute:: screening_description
:type: Optional[str]
The (English) display string for the screening conditions. The (English) display string for the screening conditions.
This tag was available in ICC 3.2, but it is removed from This tag was available in ICC 3.2, but it is removed from
version 4. version 4.
:type: :py:class:`unicode` or ``None``
.. py:attribute:: red_primary .. py:attribute:: red_primary
:type: Optional[tuple[tuple[float]]]
The XYZ-transformed of the RGB primary color red (1, 0, 0). 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 .. py:attribute:: green_primary
:type: Optional[tuple[tuple[float]]]
The XYZ-transformed of the RGB primary color green (0, 1, 0). 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 .. py:attribute:: blue_primary
:type: Optional[tuple[tuple[float]]]
The XYZ-transformed of the RGB primary color blue (0, 0, 1). 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 .. py:attribute:: is_matrix_shaper
:type: bool
True if this profile is implemented as a matrix shaper (see True if this profile is implemented as a matrix shaper (see
documentation on LCMS). documentation on LCMS).
:type: :py:class:`bool`
.. py:attribute:: clut .. py:attribute:: clut
:type: dict[tuple[bool]]
Returns a dictionary of all supported intents and directions for Returns a dictionary of all supported intents and directions for
the CLUT model. 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``, The elements of the tuple are booleans. If the value is ``True``,
that intent is supported for that direction. that intent is supported for that direction.
:type: :py:class:`dict` of boolean 3-tuples
.. py:attribute:: intent_supported .. py:attribute:: intent_supported
:type: dict[tuple[bool]]
Returns a dictionary of all supported intents and directions. 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``, The elements of the tuple are booleans. If the value is ``True``,
that intent is supported for that direction. that intent is supported for that direction.
:type: :py:class:`dict` of boolean 3-tuples
.. py:attribute:: color_space .. py:attribute:: color_space
:type: str
Deprecated but retained for backwards compatibility. Deprecated but retained for backwards compatibility.
Interpreted value of :py:attr:`.xcolor_space`. May be the Interpreted value of :py:attr:`.xcolor_space`. May be the
empty string if value could not be decoded. empty string if value could not be decoded.
:type: :py:class:`string`
.. py:attribute:: pcs .. py:attribute:: pcs
:type: str
Deprecated but retained for backwards compatibility. Deprecated but retained for backwards compatibility.
Interpreted value of :py:attr:`.connection_space`. May be Interpreted value of :py:attr:`.connection_space`. May be
the empty string if value could not be decoded. the empty string if value could not be decoded.
:type: :py:class:`string`
.. py:attribute:: product_model .. py:attribute:: product_model
:type: str
Deprecated but retained for backwards compatibility. Deprecated but retained for backwards compatibility.
ASCII-encoded value of :py:attr:`.model`. ASCII-encoded value of :py:attr:`.model`.
:type: :py:class:`string`
.. py:attribute:: product_manufacturer .. py:attribute:: product_manufacturer
:type: str
Deprecated but retained for backwards compatibility. Deprecated but retained for backwards compatibility.
ASCII-encoded value of :py:attr:`.manufacturer`. ASCII-encoded value of :py:attr:`.manufacturer`.
:type: :py:class:`string`
.. py:attribute:: product_copyright .. py:attribute:: product_copyright
:type: str
Deprecated but retained for backwards compatibility. Deprecated but retained for backwards compatibility.
ASCII-encoded value of :py:attr:`.copyright`. ASCII-encoded value of :py:attr:`.copyright`.
:type: :py:class:`string`
.. py:attribute:: product_description .. py:attribute:: product_description
:type: str
Deprecated but retained for backwards compatibility. Deprecated but retained for backwards compatibility.
ASCII-encoded value of :py:attr:`.profile_description`. ASCII-encoded value of :py:attr:`.profile_description`.
:type: :py:class:`string`
.. py:attribute:: product_desc .. py:attribute:: product_desc
:type: str
Deprecated but retained for backwards compatibility. Deprecated but retained for backwards compatibility.
ASCII-encoded value of :py:attr:`.profile_description`. 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, depending on the value of the description, copyright,
manufacturer and model fields). manufacturer and model fields).
:type: :py:class:`string`
There is one function defined on the class: There is one function defined on the class:
.. py:method:: is_intent_supported(intent, direction) .. 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:currentmodule:: None
.. py:function:: abs(image) .. py:function:: abs(image)
:noindex:
Absolute value. Absolute value.
.. py:function:: convert(image, mode) .. py:function:: convert(image, mode)
:noindex:
Convert image to the given mode. The mode must be given as a string Convert image to the given mode. The mode must be given as a string
constant. constant.
.. py:function:: float(image) .. py:function:: float(image)
:noindex:
Convert image to 32-bit floating point. This is equivalent to Convert image to 32-bit floating point. This is equivalent to
convert(image, “F”). convert(image, “F”).
.. py:function:: int(image) .. py:function:: int(image)
:noindex:
Convert image to 32-bit integer. This is equivalent to convert(image, “I”). 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. integers if necessary to get a correct result.
.. py:function:: max(image1, image2) .. py:function:: max(image1, image2)
:noindex:
Maximum value. Maximum value.
.. py:function:: min(image1, image2) .. py:function:: min(image1, image2)
:noindex:
Minimum value. Minimum value.