Skip to content

Commit c826b93

Browse files
committed
Document MAXBLOCK
1 parent 1435339 commit c826b93

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

docs/reference/ImageFile.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,5 +74,6 @@ Constants
7474
---------
7575

7676
.. autodata:: PIL.ImageFile.LOAD_TRUNCATED_IMAGES
77+
.. autodata:: PIL.ImageFile.MAXBLOCK
7778
.. autodata:: PIL.ImageFile.ERRORS
7879
:annotation:

src/PIL/ImageFile.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@
4646
logger = logging.getLogger(__name__)
4747

4848
MAXBLOCK = 65536
49+
"""
50+
By default, Pillow processes image data in blocks. This helps to prevent excessive use
51+
of resources. Codecs may disable this behaviour with ``_pulls_fd`` or ``_pushes_fd``.
52+
53+
When reading an image, this is the number of bytes to read at once.
54+
55+
When writing an image, this is the number of bytes to write at once.
56+
If the image width times 4 is greater, then that will be used instead.
57+
Plugins may also set a greater number.
58+
59+
User code may set this to another number.
60+
"""
4961

5062
SAFEBLOCK = 1024 * 1024
5163

0 commit comments

Comments
 (0)