- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I display an image using Pillow in Tkinter?
Python provides Pillow Package (PIL) to process and load the images in the application. An image can be loaded using the inbuilt Image.open("image location") method. Further, we can use a Label widget to display the Image in the window.
#Import tkinter library from tkinter import * from PIL import Image,ImageTk #Create an instance of tkinter frame win = Tk() #Set the geometry win.geometry("750x550") #Load the image img= Image.open("tutorialspoint.jpg") #Convert To photoimage tkimage= ImageTk.PhotoImage(img) #Display the Image label=Label(win,image=tkimage) label.pack() win.mainloop()
Running the above code will display an image in the window.
Before executing the code, make sure you have the image in the same project directory, or provide the absolute path of the image location.
- How can I display an image using cv2 in Python?
- Rotating an image using Pillow library
- Finding edges in an image using Pillow
- Cropping an image using the Pillow library
- How can I display an image inside SVG circle in HTML5?
- Applying MinFilter on an image using Pillow library
- Applying MaxFilter on an image using Pillow library
- Applying ModeFilter on an image using Pillow library
- Applying MedianFilter on an image using Pillow library
- Loading and displaying an image using the Pillow library
- How to resize an image using Tkinter?
- Applying Gaussian Blur to an image using the Pillow library
- Applying Box Blur to an image using the Pillow library
- Applying rank filter to an image using the Pillow library
- How can I display an np.array with pylab.imshow() using Matplotlib?