mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-07-10 16:22:22 +03:00
__exit__ does not destroy the core image object
This commit is contained in:
parent
fa74f2272b
commit
669512c2ac
|
@ -59,10 +59,14 @@ Image Lifecycle
|
||||||
``Image.Image.seek()`` can load the appropriate frame.
|
``Image.Image.seek()`` can load the appropriate frame.
|
||||||
|
|
||||||
* ``Image.Image.close()`` Closes the file and destroys the core image object.
|
* ``Image.Image.close()`` Closes the file and destroys the core image object.
|
||||||
This is used in the Pillow context manager support. e.g.::
|
|
||||||
|
The Pillow context manager will also close the file, but will not destroy
|
||||||
|
the core image object. e.g.::
|
||||||
|
|
||||||
with Image.open('test.jpg') as img:
|
with Image.open('test.jpg') as img:
|
||||||
... # image operations here.
|
img.load()
|
||||||
|
assert img.fp is None
|
||||||
|
img.save('test.png')
|
||||||
|
|
||||||
|
|
||||||
The lifecycle of a single-frame image is relatively simple. The file must
|
The lifecycle of a single-frame image is relatively simple. The file must
|
||||||
|
|
Loading…
Reference in New Issue
Block a user