Coders Packet

Crop Image Using Python

By Akshitha Theretupally

A simple python program to take an image as input and print and the required cropped image using Pillow library.

This is a simple program in python which aimed at creating a cropped image of the image taken as input. Cropping is an important operation to remove unwanted operations and get the required image.

Requirement: PIL library

PIL is the Python Imaging Library which provides python with the capability to edit images.  


1. Before cropping the image we should know the required dimensions of the image we need.

2. According to the dimensions, input the pixels you want to crop.

3. Cropping starts from left and then upper,right, and lower.

Start from the left and upper corner     (Left, Upper)=(x-axis, y-axis)

Next, from the right and lower corner   (Right, Lower)=(x-axis, y-axis)

The program displays the cropped image.

Download Complete Code


No comments yet