इस कार्यक्रम में, हम पिलो लाइब्रेरी का उपयोग करके एक छवि क्रॉप करेंगे। हम उसी के लिए फसल () फ़ंक्शन का उपयोग करेंगे। फ़ंक्शन छवि को क्रॉप करने के लिए बाएं, ऊपर, दाएं, नीचे पिक्सेल निर्देशांक लेता है।
मूल चित्र

एल्गोरिदम
Step 1: Import Image from Pillow. Step 2: Read the image. Step 3: Crop the image using the crop function. Step 4: Display the output.
उदाहरण कोड
from PIL import Image
im = Image.open('testimage.jpg')
width, height = im.size
left = 5
top = height / 2
right = 164
bottom = 3 * height / 2
im1 = im.crop((left, top, right, bottom))
im1.show() आउटपुट
