To verify that the installation worked, open a Python terminal and run from PIL import Image. This command makes Python use the pip installer program to download the module from the official Python Package Index at. To install this library on macOS or Linux, open a Terminal window and run python3 -m pip install -user pillow. To install this library on Windows, open a command prompt window and run py -m pip install -user pillow. It has several functions to perform resizing, copying, cropping, and other common actions on images. This library allows your Python programs to create and modify image files including PNGs, JPEGs, and GIFs. This chapter’s project requires the Pillow image library. Next, we’ll present the Python source code for the program with accompanying explanation of the code. The Python program uses the Pillow image library to read this image data and produce a recursive image.įirst, we’ll cover how to install the Pillow library and how the Droste Maker algorithm works. Using a graphics program such as Microsoft Paint or Adobe Photoshop, you’ll prepare the image by covering an area of it with a pure magenta color, indicating where to place the recursive image. In this chapter we’ll create a Droste Maker program that can generate similar recursive images from any photograph or drawing you have, whether it be a museum patron looking at an exhibit of themself, a cat in front of a computer monitor of a cat in front of a computer monitor, or something else entirely.įigure 14-1: The recursive illustration on a tin of Droste’s Cacao Shown in Figure 14-1, the tin features an image of a nurse holding a meal tray containing a tin of Droste cocoa, which itself bears the illustration. The Droste effect is a recursive art technique named after a 1904 illustration on a tin of Droste’s Cacao, a Dutch brand of cocoa.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |