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)