There are numerous tools for designing GUI (Graphical User Interface) in Python such as
JPython, etc where Tkinter is the standard Python GUI library, it provides a simple and efficient way to create GUI applications in Python.
Reading Images With Tkinter
In order to do various operations and manipulations on images, we require Python
Pillow package. If the
Pillow package is not present in the system then it can be installed using the below command.
- In Command prompt:
pip install Pillow
- In Anaconda prompt:
conda install -c anaconda pillow
Example 1: The below program demonstrates how to read images with
In the above program, an image is loaded using the
PhotoImage() method and then it is read by using the
pack() method arranges the main window and the
mainloop() function is used to run the application in an infinite loop.
Example 2: Let us look at another example where we arrange the image parameters along with application parameters.
In the above program, the application parameters are handled by using the
Canvas() method and the image parameters are handled using
create_image() method such that the image
gfg.png is displayed in the main window having defined height and width .
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.
- Reading images in Python
- Arithmetic Operations on Images using OpenCV | Set-2 (Bitwise Operations on Binary Images)
- Loading Images in Tkinter using PIL
- Rename a folder of images using Tkinter
- How To Use Images as Backgrounds in Tkinter?
- Reading Python File-Like Objects from C | Python
- Working with Images in Python
- Erosion and Dilation of images using OpenCV in python
- Get emotions of images using Microsoft emotion API in Python
- Addition and Blending of images using OpenCV in Python
- Filtering Images based on size attributes in Python
- Extract images from video in Python
- Python | Uploading images in Django
- Python | Display images with PyGame
- Python | Denoising of colored images using opencv
- How to download Google Images using Python
- Python | Create video using multiple images using OpenCV
- Python | Grayscaling of Images using OpenCV
- Python | Working with PNG Images using Matplotlib
- Python | Copy and Paste Images onto other Image using Pillow
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.