Added import statements to make examples self-contained [ci skip]

This commit is contained in:
Andrew Murray 2017-05-29 19:41:30 +10:00
parent 98de727575
commit cafc311943

View File

@ -276,6 +276,7 @@ Converting between modes
::
from PIL import Image
im = Image.open("hopper.ppm").convert("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
simply pass it the filename as an argument::
from PIL import Image
im = Image.open("hopper.ppm")
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")
im = Image.open(fp)