mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-27 09:44:31 +03:00
Added import statements to make examples self-contained [ci skip]
This commit is contained in:
parent
98de727575
commit
cafc311943
|
@ -276,6 +276,7 @@ Converting between modes
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
im = Image.open("hopper.ppm").convert("L")
|
im = Image.open("hopper.ppm").convert("L")
|
||||||
|
|
||||||
The library supports transformations between each supported mode and the “L”
|
The library supports transformations between each supported mode and the “L”
|
||||||
|
@ -459,6 +460,7 @@ As described earlier, the :py:func:`~PIL.Image.open` function of the
|
||||||
:py:mod:`~PIL.Image` module is used to open an image file. In most cases, you
|
:py:mod:`~PIL.Image` module is used to open an image file. In most cases, you
|
||||||
simply pass it the filename as an argument::
|
simply pass it the filename as an argument::
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
im = Image.open("hopper.ppm")
|
im = Image.open("hopper.ppm")
|
||||||
|
|
||||||
If everything goes well, the result is an :py:class:`PIL.Image.Image` object.
|
If everything goes well, the result is an :py:class:`PIL.Image.Image` object.
|
||||||
|
@ -473,6 +475,7 @@ Reading from an open file
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
fp = open("hopper.ppm", "rb")
|
fp = open("hopper.ppm", "rb")
|
||||||
im = Image.open(fp)
|
im = Image.open(fp)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user