change the size of the image in tkinter python

How to Resize Image in Tkinter Python | Tkinter Python

*Video Link:-
https://youtu.be/GECXvh9FKJ4

*Details:- In this program, we are setting the size of the image same as the size of the label using PIL package.

*Coding:-
from PIL import Image
from PIL import ImageTk

photo=Image.open(’male.jpg’)

def fit(label, photo):

width=label.winfo_width()

height=label.winfo_height()

img=photo.resize((width,height), Image.ANTIALIAS)

img1=ImageTk.PhotoImage(img)

label.configure(image=img1)

label.image=img1


*Tags:-
#python #tkinter #label #image #widget #online #learning #tutorial #india #coding #programming #computercodingclass

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

Computer Coding Class
Computer Coding Class

Written by Computer Coding Class

It is a YouTube Channel to learn Computer Coding and Programming in different famous Programming languages like C++, Python, Java from scratch to advanced leveI

No responses yet

Write a response