mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
fix docs typos
This commit is contained in:
parent
6cd0d60315
commit
d36850e037
|
@ -257,6 +257,9 @@ Using the :py:meth:`~PIL.Image.Image.draft` method, you can speed things up by
|
|||
converting ``RGB`` images to ``L``, and resize images to 1/2, 1/4 or 1/8 of
|
||||
their original size while loading them.
|
||||
|
||||
By default Pillow doesn't allow loading of truncated JPEG files, set
|
||||
:data:`.ImageFile.LOAD_TRUNCATED_IMAGES` to override this.
|
||||
|
||||
The :py:meth:`~PIL.Image.open` method may set the following
|
||||
:py:attr:`~PIL.Image.Image.info` properties if available:
|
||||
|
||||
|
@ -473,6 +476,9 @@ image formats, EXIF data is not guaranteed to be present in
|
|||
:py:attr:`~PIL.Image.Image.info` until :py:meth:`~PIL.Image.Image.load` has been
|
||||
called.
|
||||
|
||||
By default Pillow doesn't allow loading of truncated PNG files, set
|
||||
:data:`.ImageFile.LOAD_TRUNCATED_IMAGES` to override this.
|
||||
|
||||
The :py:func:`~PIL.Image.open` function sets the following
|
||||
:py:attr:`~PIL.Image.Image.info` properties, when appropriate:
|
||||
|
||||
|
|
|
@ -52,3 +52,10 @@ Classes
|
|||
.. autoclass:: PIL.ImageFile.StubImageFile()
|
||||
:members:
|
||||
:show-inheritance:
|
||||
|
||||
Constants
|
||||
---------
|
||||
|
||||
.. autodata:: PIL.ImageFile.LOAD_TRUNCATED_IMAGES
|
||||
.. autodata:: PIL.ImageFile.ERRORS
|
||||
:annotation:
|
||||
|
|
|
@ -56,3 +56,19 @@ Methods
|
|||
|
||||
.. autoclass:: PIL.ImageFont.TransposedFont
|
||||
:members:
|
||||
|
||||
Constants
|
||||
---------
|
||||
|
||||
.. data:: PIL.ImageFont.LAYOUT_BASIC
|
||||
|
||||
Use basic text layout for TrueType font.
|
||||
Advanced features such as text direction are not supported.
|
||||
|
||||
.. data:: PIL.ImageFont.LAYOUT_RAQM
|
||||
|
||||
Use Raqm text layout for TrueType font.
|
||||
Advanced features are supported.
|
||||
|
||||
Requires Raqm, you can check support using
|
||||
:py:func:`PIL.features.check_feature` with ``feature="raqm"``.
|
||||
|
|
|
@ -1740,7 +1740,7 @@ class Image:
|
|||
Rewrites the image to reorder the palette.
|
||||
|
||||
:param dest_map: A list of indexes into the original palette.
|
||||
e.g. [1,0] would swap a two item palette, and list(range(256))
|
||||
e.g. ``[1,0]`` would swap a two item palette, and ``list(range(256))``
|
||||
is the identity transform.
|
||||
:param source_palette: Bytes or None.
|
||||
:returns: An :py:class:`~PIL.Image.Image` object.
|
||||
|
@ -1922,16 +1922,16 @@ class Image:
|
|||
|
||||
def reduce(self, factor, box=None):
|
||||
"""
|
||||
Returns a copy of the image reduced by `factor` times.
|
||||
If the size of the image is not dividable by the `factor`,
|
||||
Returns a copy of the image reduced ``factor`` times.
|
||||
If the size of the image is not dividable by ``factor``,
|
||||
the resulting size will be rounded up.
|
||||
|
||||
:param factor: A greater than 0 integer or tuple of two integers
|
||||
for width and height separately.
|
||||
:param box: An optional 4-tuple of ints providing
|
||||
the source image region to be reduced.
|
||||
The values must be within (0, 0, width, height) rectangle.
|
||||
If omitted or None, the entire source is used.
|
||||
The values must be within ``(0, 0, width, height)`` rectangle.
|
||||
If omitted or ``None``, the entire source is used.
|
||||
"""
|
||||
if not isinstance(factor, (list, tuple)):
|
||||
factor = (factor, factor)
|
||||
|
|
|
@ -250,7 +250,9 @@ class ImageCmsTransform(Image.ImagePointHandler):
|
|||
|
||||
|
||||
def get_display_profile(handle=None):
|
||||
""" (experimental) Fetches the profile for the current display device.
|
||||
"""
|
||||
(experimental) Fetches the profile for the current display device.
|
||||
|
||||
:returns: ``None`` if the profile is not known.
|
||||
"""
|
||||
|
||||
|
@ -624,7 +626,7 @@ def applyTransform(im, transform, inPlace=False):
|
|||
:param im: An :py:class:`~PIL.Image.Image` object, and im.mode must be the same
|
||||
as the ``inMode`` supported by the transform.
|
||||
:param transform: A valid CmsTransform class object
|
||||
:param inPlace: Bool. If ``True``, ``im` is modified in place and ``None`` is
|
||||
:param inPlace: Bool. If ``True``, ``im`` is modified in place and ``None`` is
|
||||
returned, if ``False``, a new :py:class:`~PIL.Image.Image` object with the
|
||||
transform applied is returned (and ``im`` is not changed). The default is
|
||||
``False``.
|
||||
|
|
|
@ -40,6 +40,7 @@ MAXBLOCK = 65536
|
|||
SAFEBLOCK = 1024 * 1024
|
||||
|
||||
LOAD_TRUNCATED_IMAGES = False
|
||||
"""Whether loading of truncated image files is currently enabled. User code may change this."""
|
||||
|
||||
ERRORS = {
|
||||
-1: "image buffer overrun error",
|
||||
|
@ -48,6 +49,7 @@ ERRORS = {
|
|||
-8: "bad configuration",
|
||||
-9: "out of memory error",
|
||||
}
|
||||
"""Dict of known error codes returned from :meth:`.PyDecoder.decode`."""
|
||||
|
||||
|
||||
#
|
||||
|
@ -583,7 +585,7 @@ class PyCodecState:
|
|||
class PyDecoder:
|
||||
"""
|
||||
Python implementation of a format decoder. Override this class and
|
||||
add the decoding logic in the `decode` method.
|
||||
add the decoding logic in the :meth:`decode` method.
|
||||
|
||||
See :ref:`Writing Your Own File Decoder in Python<file-decoders-py>`
|
||||
"""
|
||||
|
@ -615,9 +617,9 @@ class PyDecoder:
|
|||
Override to perform the decoding process.
|
||||
|
||||
:param buffer: A bytes object with the data to be decoded.
|
||||
:returns: A tuple of (bytes consumed, errcode).
|
||||
:returns: A tuple of ``(bytes consumed, errcode)``.
|
||||
If finished with decoding return <0 for the bytes consumed.
|
||||
Err codes are from `ERRORS`
|
||||
Err codes are from :data:`.ImageFile.ERRORS`.
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
|
|
|
@ -638,7 +638,7 @@ def truetype(font=None, size=10, index=0, encoding="", layout_engine=None):
|
|||
This specifies the character set to use. It does not alter the
|
||||
encoding of any text provided in subsequent operations.
|
||||
:param layout_engine: Which layout engine to use, if available:
|
||||
`ImageFont.LAYOUT_BASIC` or `ImageFont.LAYOUT_RAQM`.
|
||||
:data:`.ImageFont.LAYOUT_BASIC` or :data:`.ImageFont.LAYOUT_RAQM`.
|
||||
|
||||
You can check support for Raqm layout using
|
||||
:py:func:`PIL.features.check_feature` with ``feature="raqm"``.
|
||||
|
|
|
@ -34,7 +34,7 @@ Possible subsampling values are 0, 1 and 2 that correspond to 4:4:4, 4:2:2 and
|
|||
4:2:0.
|
||||
|
||||
You can get the subsampling of a JPEG with the
|
||||
`JpegImagePlugin.get_sampling(im)` function.
|
||||
:func:`.JpegImagePlugin.get_sampling` function.
|
||||
|
||||
In JPEG compressed data a JPEG marker is used instead of an EXIF tag.
|
||||
(ref.: https://www.exiv2.org/tags.html)
|
||||
|
@ -64,7 +64,7 @@ The tables format between im.quantization and quantization in presets differ in
|
|||
3. The zigzag order is remove in the preset (needed by libjpeg >= 6a).
|
||||
|
||||
You can convert the dict format to the preset format with the
|
||||
`JpegImagePlugin.convert_dict_qtables(dict_qtables)` function.
|
||||
:func:`.JpegImagePlugin.convert_dict_qtables()` function.
|
||||
|
||||
Libjpeg ref.:
|
||||
https://web.archive.org/web/20120328125543/http://www.jpegcameras.com/libjpeg/libjpeg-3.html
|
||||
|
|
|
@ -414,7 +414,7 @@ class ImageFileDirectory_v2(MutableMapping):
|
|||
|
||||
The tiff metadata type of each item is stored in a dictionary of
|
||||
tag types in
|
||||
`~PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype`. The types
|
||||
:attr:`~PIL.TiffImagePlugin.ImageFileDirectory_v2.tagtype`. The types
|
||||
are read from a tiff file, guessed from the type added, or added
|
||||
manually.
|
||||
|
||||
|
@ -885,7 +885,7 @@ class ImageFileDirectory_v1(ImageFileDirectory_v2):
|
|||
('Some Data',)
|
||||
|
||||
Also contains a dictionary of tag types as read from the tiff image file,
|
||||
`~PIL.TiffImagePlugin.ImageFileDirectory_v1.tagtype`.
|
||||
:attr:`~PIL.TiffImagePlugin.ImageFileDirectory_v1.tagtype`.
|
||||
|
||||
Values are returned as a tuple.
|
||||
|
||||
|
@ -899,6 +899,10 @@ class ImageFileDirectory_v1(ImageFileDirectory_v2):
|
|||
tags = property(lambda self: self._tags_v1)
|
||||
tagdata = property(lambda self: self._tagdata)
|
||||
|
||||
# defined in ImageFileDirectory_v2
|
||||
tagtype: dict
|
||||
"""Dictionary of tag types"""
|
||||
|
||||
@classmethod
|
||||
def from_v2(cls, original):
|
||||
""" Returns an
|
||||
|
|
Loading…
Reference in New Issue
Block a user