VOOZH about

URL: https://www.geeksforgeeks.org/python/how-to-resize-image-in-python-tkinter/

⇱ How to resize Image in Python - Tkinter? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to resize Image in Python - Tkinter?

Last Updated : 23 Jul, 2025

Python provides multiple options for building GUI (Graphical User Interface) applications. Among them, Tkinter is one of the most widely used and simplest options. It comes bundled with Python and serves as a standard interface to the Tk GUI toolkit.

However, Tkinter alone does not provide support for advanced image operations such as resizing. To work with images effectively, we use the Pillow library, which integrates smoothly with Tkinter and allows image processing tasks like resizing, cropping, rotating, etc.

In this article, we’ll learn how to resize an image in Python using Tkinter and Pillow and display it in a GUI window.

Syntax

Image.resize((width, height), resample=Image.BICUBIC)

Parameters:

  • width: required width of the resized image.
  • height: required height of the resized image.

Installation

1. Install Pillow

You need to install Pillow (a modern fork of the Python Imaging Library):

pip install pillow

2. Tkinter Installation Note

Windows & macOS: Tkinter comes pre-installed with Python.

Linux (some distros): You may need to install it manually.

On Ubuntu/Debian:

sudo apt-get install python3-tk

Step-by-Step Implementation

Step 1: Import Required Libraries

Step 2: Load the Image using Pillow

Step 3: Resize the Image

Step 4: Display the Image in Tkinter GUI

Complete Code

Output:-

👁 Image
250x200

Explanation:

  • Image.open() loads the image.
  • resize() returns a resized copy of the image.
  • ImageTk.PhotoImage() converts the image into a format Tkinter understands.
  • Label() is used to display the image.
  • label.image = img keeps a reference to avoid the image from disappearing. 
Comment