mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-12 18:26:17 +03:00
Trim trailing whitespace docs dir
This commit is contained in:
parent
22a59ac839
commit
b13025129b
|
@ -168,10 +168,10 @@ Instances of the :py:class:`Image` class have the following attributes:
|
|||
|
||||
.. py:attribute:: filename
|
||||
|
||||
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
|
||||
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
|
||||
|
|
|
@ -40,8 +40,8 @@ variables:
|
|||
|
||||
* ``PILLOW_BLOCK_SIZE``, in bytes, K, or M. Specifies the maximum
|
||||
block size for ``ImagingAllocateArray``. Valid values are
|
||||
integers, with an optional `k` or `m` suffix. Defaults to 16M.
|
||||
integers, with an optional `k` or `m` suffix. Defaults to 16M.
|
||||
|
||||
* ``PILLOW_BLOCKS_MAX`` Specifies the number of freed blocks to
|
||||
retain to fill future memory requests. Any freed blocks over this
|
||||
threshold will be returned to the OS immediately. Defaults to 0.
|
||||
threshold will be returned to the OS immediately. Defaults to 0.
|
||||
|
|
|
@ -3,8 +3,8 @@ Internal Reference Docs
|
|||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
|
||||
open_files
|
||||
limits
|
||||
block_allocator
|
||||
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ File Handling in Pillow
|
|||
When opening a file as an image, Pillow requires a filename,
|
||||
pathlib.Path object, or a file-like object. Pillow uses the filename
|
||||
or Path to open a file, so for the rest of this article, they will all
|
||||
be treated as a file-like object.
|
||||
be treated as a file-like object.
|
||||
|
||||
The first four of these items are equivalent, the last is dangerous
|
||||
and may fail::
|
||||
|
@ -12,14 +12,14 @@ and may fail::
|
|||
from PIL import Image
|
||||
import io
|
||||
import pathlib
|
||||
|
||||
|
||||
im = Image.open('test.jpg')
|
||||
|
||||
im2 = Image.open(pathlib.Path('test.jpg'))
|
||||
|
||||
f = open('test.jpg', 'rb')
|
||||
im3 = Image.open(f)
|
||||
|
||||
|
||||
with open('test.jpg', 'rb') as f:
|
||||
im4 = Image.open(io.BytesIO(f.read()))
|
||||
|
||||
|
@ -31,10 +31,10 @@ and may fail::
|
|||
The documentation specifies that the file will be closed after the
|
||||
``Image.Image.load()`` method is called. This is an aspirational
|
||||
specification rather than an accurate reflection of the state of the
|
||||
code.
|
||||
code.
|
||||
|
||||
Pillow cannot in general close and reopen a file, so any access to
|
||||
that file needs to be prior to the close.
|
||||
that file needs to be prior to the close.
|
||||
|
||||
Issues
|
||||
------
|
||||
|
@ -44,10 +44,10 @@ The current open file handling is inconsistent at best:
|
|||
* Most of the image plugins do not close the input file.
|
||||
* Multi-frame images behave badly when seeking through the file, as
|
||||
it's legal to seek backward in the file until the last image is
|
||||
read, and then it's not.
|
||||
read, and then it's not.
|
||||
* Using the file context manager to provide a file-like object to
|
||||
Pillow is dangerous unless the context of the image is limited to
|
||||
the context of the file.
|
||||
the context of the file.
|
||||
|
||||
Image Lifecycle
|
||||
---------------
|
||||
|
@ -59,7 +59,7 @@ Image Lifecycle
|
|||
* ``Image.Image.load()`` when the pixel data from the image is
|
||||
required, ``load()`` is called. The current frame is read into
|
||||
memory. The image can now be used independently of the underlying
|
||||
image file.
|
||||
image file.
|
||||
|
||||
* ``Image.Image.seek()`` in the case of multi-frame images
|
||||
(e.g. multipage TIFF and animated GIF) the image file left open so
|
||||
|
@ -72,12 +72,12 @@ Image Lifecycle
|
|||
support. e.g.::
|
||||
|
||||
with Image.open('test.jpg') as img:
|
||||
... # image operations here.
|
||||
... # image operations here.
|
||||
|
||||
|
||||
The lifecycle of a single frame image is relatively simple. The file
|
||||
must remain open until the ``load()`` or ``close()`` function is
|
||||
called.
|
||||
called.
|
||||
|
||||
Multi-frame images are more complicated. The ``load()`` method is not
|
||||
a terminal method, so it should not close the underlying file. The
|
||||
|
@ -85,7 +85,7 @@ current behavior of ``seek()`` closing the underlying file on
|
|||
accessing the last frame is presumably a heuristic for closing the
|
||||
file after iterating through the entire sequence. In general, Pillow
|
||||
does not know if there are going to be any requests for additional
|
||||
data until the caller has explicitly closed the image.
|
||||
data until the caller has explicitly closed the image.
|
||||
|
||||
|
||||
Complications
|
||||
|
@ -94,7 +94,7 @@ Complications
|
|||
* TiffImagePlugin has some code to pass the underlying file descriptor
|
||||
into libtiff (if working on an actual file). Since libtiff closes
|
||||
the file descriptor internally, it is duplicated prior to passing it
|
||||
into libtiff.
|
||||
into libtiff.
|
||||
|
||||
* ``decoder.handles_eof`` This slightly misnamed flag indicates that
|
||||
the decoder wants to be called with a 0 length buffer when reads are
|
||||
|
@ -118,8 +118,8 @@ Proposed File Handling
|
|||
* ``Image.Image.load()`` should close the image file, unless there are
|
||||
multiple frames.
|
||||
|
||||
* ``Image.Image.seek()`` should never close the image file.
|
||||
* ``Image.Image.seek()`` should never close the image file.
|
||||
|
||||
* Users of the library should call ``Image.Image.close()`` on any
|
||||
multi-frame image to ensure that the underlying file is closed.
|
||||
multi-frame image to ensure that the underlying file is closed.
|
||||
|
||||
|
|
|
@ -23,17 +23,17 @@ redirected to the olefile package. Direct accesses to
|
|||
``PIL.OlefileIO`` raises a deprecation warning, then patches the
|
||||
upstream olefile into ``sys.modules`` in its place.
|
||||
|
||||
SGI image save
|
||||
SGI image save
|
||||
==============
|
||||
|
||||
It is now possible to save images in modes ``L``, ``RGB``, and
|
||||
``RGBA`` to the uncompressed SGI image format.
|
||||
``RGBA`` to the uncompressed SGI image format.
|
||||
|
||||
Zero sized images
|
||||
=================
|
||||
|
||||
Pillow 3.4.0 removed support for creating images with (0,0) size. This
|
||||
has been reenabled, restoring pre 3.4 behavior.
|
||||
has been reenabled, restoring pre 3.4 behavior.
|
||||
|
||||
Internal handles_eof flag
|
||||
=========================
|
||||
|
@ -41,11 +41,11 @@ Internal handles_eof flag
|
|||
The ``handles_eof flag`` for decoding images has been removed, as there
|
||||
were no internal users of the flag. Anyone maintaining image decoders
|
||||
outside of the Pillow source tree should consider using the cleanup
|
||||
function pointers instead.
|
||||
function pointers instead.
|
||||
|
||||
Image.core.stretch removed
|
||||
==========================
|
||||
|
||||
The stretch function on the core image object has been removed. This
|
||||
used to be for enlarging the image, but has been aliased to resize
|
||||
recently.
|
||||
recently.
|
||||
|
|
|
@ -12,7 +12,7 @@ Several deprecated items have been removed.
|
|||
|
||||
* The methods :py:meth:`PIL.ImageDraw.ImageDraw.setink`,
|
||||
:py:meth:`PIL.ImageDraw.ImageDraw.setfill`, and
|
||||
:py:meth:`PIL.ImageDraw.ImageDraw.setfont` have been removed.
|
||||
:py:meth:`PIL.ImageDraw.ImageDraw.setfont` have been removed.
|
||||
|
||||
|
||||
Closing Files When Opening Images
|
||||
|
@ -27,7 +27,7 @@ is specified:
|
|||
responsibility of the calling code to close the file.
|
||||
|
||||
* For images where Pillow opens the file and the file is known to have
|
||||
only one frame, the file is closed after loading.
|
||||
only one frame, the file is closed after loading.
|
||||
|
||||
* If the file has more than one frame, or if it can't be determined,
|
||||
then the file is left open to permit seeking to subsequent
|
||||
|
@ -36,7 +36,7 @@ is specified:
|
|||
|
||||
* If the image is memory mapped, then we can't close the mapping to
|
||||
the underlying file until we are done with the image. The mapping
|
||||
will be closed in the ``close`` or ``__del__`` method.
|
||||
will be closed in the ``close`` or ``__del__`` method.
|
||||
|
||||
|
||||
Changes to GIF Handling When Saving
|
||||
|
@ -50,7 +50,7 @@ saving images. There are two external changes that arise from this:
|
|||
|
||||
* The image to be saved is no longer modified in place by any of the
|
||||
operations of the save function. Previously it was modified when
|
||||
optimizing the image palette.
|
||||
optimizing the image palette.
|
||||
|
||||
This refactor fixed some bugs with palette handling when saving
|
||||
multiple frame GIFs.
|
||||
|
@ -60,7 +60,7 @@ New Method: Image.remap_palette
|
|||
|
||||
The method :py:meth:`PIL.Image.Image.remap_palette()` has been
|
||||
added. This method was hoisted from the GifImagePlugin code used to
|
||||
optimize the palette.
|
||||
optimize the palette.
|
||||
|
||||
Added Decoder Registry and Support for Python Based Decoders
|
||||
============================================================
|
||||
|
@ -76,7 +76,7 @@ Tests
|
|||
=====
|
||||
|
||||
Many tests have been added, including correctness tests for image
|
||||
formats that have been previously untested.
|
||||
formats that have been previously untested.
|
||||
|
||||
We are now running automated tests in Docker containers against more
|
||||
Linux versions than are provided on Travis CI, which is currently
|
||||
|
|
|
@ -20,7 +20,7 @@ TIFF Metadata Changes
|
|||
single element tuple. This is only with the new api, not the legacy
|
||||
api. This normalizes the handling of fields, so that the metadata
|
||||
with inferred or image specified counts are handled the same as
|
||||
metadata with count specified in the TIFF spec.
|
||||
metadata with count specified in the TIFF spec.
|
||||
* The ``PhotoshopInfo``, ``XMP``, and ``JPEGTables`` tags now have a
|
||||
defined type (bytes) and a count of 1.
|
||||
* The ``ImageJMetaDataByteCounts`` tag now has an arbitrary number of
|
||||
|
@ -85,7 +85,7 @@ There is a new :py:class:`PIL.ImageFilter.MultibandFilter` base class
|
|||
for image filters that can run on all channels of an image in one
|
||||
operation. The original :py:class:`PIL.ImageFilter.Filter` class
|
||||
remains for image filters that can process only single band images, or
|
||||
require splitting of channels prior to filtering.
|
||||
require splitting of channels prior to filtering.
|
||||
|
||||
Other Changes
|
||||
=============
|
||||
|
@ -109,7 +109,7 @@ images to and from RGB and RGBA formats. The image data is truncated
|
|||
to 8-bit precision.
|
||||
|
||||
Pillow can now read RLE encoded SGI images in both 8 and 16-bit
|
||||
precision.
|
||||
precision.
|
||||
|
||||
Performance
|
||||
^^^^^^^^^^^
|
||||
|
@ -124,7 +124,7 @@ This release contains several performance improvements:
|
|||
* ``Image.transpose`` has been accelerated 15% or more by using a cache
|
||||
friendly algorithm.
|
||||
* ImageFilters based on Kernel convolution are significantly faster
|
||||
due to the new MultibandFilter feature.
|
||||
due to the new MultibandFilter feature.
|
||||
* All memory allocation for images is now done in blocks, rather than
|
||||
falling back to an allocation for each scan line for images larger
|
||||
than the block size.
|
||||
|
|
|
@ -69,7 +69,7 @@ GIF Disposal
|
|||
^^^^^^^^^^^^
|
||||
|
||||
Multiframe GIF images now take an optional disposal parameter to
|
||||
specify the disposal option for changed pixels.
|
||||
specify the disposal option for changed pixels.
|
||||
|
||||
Other Changes
|
||||
=============
|
||||
|
@ -88,7 +88,7 @@ Libraqm is now Dynamically Linked
|
|||
The libraqm dependency for complex text scripts is now linked
|
||||
dynamically at runtime rather than at packaging time. This allows us
|
||||
to release binaries with support for libraqm if it is installed on the
|
||||
user's machine.
|
||||
user's machine.
|
||||
|
||||
Source Layout Changes
|
||||
^^^^^^^^^^^^^^^^^^^^^
|
||||
|
|
Loading…
Reference in New Issue
Block a user