How to Use Image in Label Tkinter
IF You Want to show Image in Label Tkinter You can Follow This.
Full Meaning of PIL is Python Image Library. PILLOW Library has Basic Imaging Functionality.
- If You Want To Resize Image You Can Use PIL Library.
- If You Want To Rotate Image You Can Use PIL Library.
- If You Want To Transform Image You Can Use PIL Library.
It Supports All of Image Such as “jpeg”, “png”, “bmp”, “gif”, “ppm”, “tiff”.
Python Pillow package can be used for creating thumbnails, converting from one format to another and print images, etc.
Note : You Must Be Use Image Ration Like as 500x375, 250x188.
Example 01:
from tkinter import *
from PIL import ImageTk, Image
from PIL import ImageTk, Image
my_window = Tk()
my_window.title("How To Resize Image")
my_window.geometry("800x400+400+86")
my_window.config(bg="#EED5B7")
my_window.title("How To Resize Image")
my_window.geometry("800x400+400+86")
my_window.config(bg="#EED5B7")
OpenImage = Image.open("E:\Python Work\love3.png") #Open Image
newImage = ImageTk.PhotoImage(OpenImage) # Convert Image Into PhotoImage
newImage = ImageTk.PhotoImage(OpenImage) # Convert Image Into PhotoImage
lbl1= Label(my_window, image=newImage) #newImage set in Label
lbl1.pack(pady=30)
lbl1.pack(pady=30)
Thanks for sharing the best information and suggestions, it is very nice and very useful to us. I appreciate the work that you have shared in this post. Keep sharing these types of articles here. photo grayscale
ردحذفإرسال تعليق