File: ImageFile.rst

package info (click to toggle)
pillow 12.0.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 72,636 kB
  • sloc: python: 49,518; ansic: 38,787; makefile: 302; sh: 168; javascript: 85
file content (79 lines) | stat: -rw-r--r-- 1,617 bytes parent folder | download
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
.. py:module:: PIL.ImageFile
.. py:currentmodule:: PIL.ImageFile

:py:mod:`~PIL.ImageFile` module
===============================

The :py:mod:`~PIL.ImageFile` module provides support functions for the image open
and save functions.

In addition, it provides a :py:class:`Parser` class which can be used to decode
an image piece by piece (e.g. while receiving it over a network connection).
This class implements the same consumer interface as the standard **sgmllib**
and **xmllib** modules.

Example: Parse an image
-----------------------

::

    from PIL import ImageFile

    fp = open("hopper.ppm", "rb")

    p = ImageFile.Parser()

    while 1:
        s = fp.read(1024)
        if not s:
            break
        p.feed(s)

    im = p.close()

    im.save("copy.jpg")


Classes
-------

.. autoclass:: PIL.ImageFile._Tile()
    :member-order: bysource
    :members:
    :show-inheritance:

.. autoclass:: PIL.ImageFile.Parser()
    :members:

.. autoclass:: PIL.ImageFile.PyCodec()
    :members:

.. autoclass:: PIL.ImageFile.PyDecoder()
    :members:
    :show-inheritance:

.. autoclass:: PIL.ImageFile.PyEncoder()
    :members:
    :show-inheritance:

.. autoclass:: PIL.ImageFile.ImageFile()
    :member-order: bysource
    :members:
    :undoc-members:
    :show-inheritance:

.. autoclass:: PIL.ImageFile.StubHandler()
    :members:
    :show-inheritance:

.. autoclass:: PIL.ImageFile.StubImageFile()
    :members:
    :show-inheritance:

Constants
---------

.. autodata:: PIL.ImageFile.LOAD_TRUNCATED_IMAGES
.. autodata:: PIL.ImageFile.MAXBLOCK
.. autodata:: PIL.ImageFile.ERRORS
    :annotation: