From cafc3119435e1602fd5b8ead2536bece17f6001f Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Mon, 29 May 2017 19:41:30 +1000 Subject: [PATCH] Added import statements to make examples self-contained [ci skip] --- docs/handbook/tutorial.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/handbook/tutorial.rst b/docs/handbook/tutorial.rst index 245d4fc2c..3319fa208 100644 --- a/docs/handbook/tutorial.rst +++ b/docs/handbook/tutorial.rst @@ -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)