![]() Then you use the _getexif() method to get metadata about your image. Here you get the width and height of the image using the image object. Create a new file named get_image_info.py and add this code to it: # get_image_info.py You can use Pillow to learn more about your images as well. This is pretty handy because now you can view your images with Python without writing an entire graphical user interface. When you run this code, you will see a window similar to the following: This will return an object that you can use to learn more about your image. Then you use Image.open() to open up an image. ![]() Here you import Image from the PIL package. To see how this works, create a new file named open_image.py and enter the following code: # open_image.py The viewer is made with Tkinter and works in much the same way as Matplotlib does when it shows a graph. You can use Pillow to open and view any of the file types mentioned in the “fully supported formats” section at the link above. For a full listing of the image file types that Pillow supports, see the following: Pillow let’s you open and view many different file types. Now that Pillow is installed, you are ready to start using it! Opening Images Here is how you would do it after opening a terminal or console window: python -m pip install pillow Installing Pillow is easy to do with pip. Now let’s get started by installing Pillow! Installing Pillow They are included with the code examples on Github. The images used in this article are some that the author has taken himself. In this articla, you will learn how to do the following with Pillow:Īs you can see, Pillow can be used for many types of image processing. You can use Pillow for several use cases including the following: Several other Python packages, such as wxPython and ReportLab, use Pillow to support loading many different image file types. The current version of this software is in Pillow, which is a fork of the original PIL to support Python 3. It allows you to process photos and do many common image file manipulations. The Python Imaging Library (PIL) is a 3rd party Python package that adds image processing capabilities to your Python interpreter.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |