How to crop an image using PIL?

Taj Koyal picture Taj Koyal · Apr 2, 2012 · Viewed 186.4k times · Source

I want to crop image in the way by removing first 30 rows and last 30 rows from the given image. I have searched but did not get the exact solution. Does somebody have some suggestions?

Answer

ninjagecko picture ninjagecko · Apr 2, 2012

There is a crop() method:

w, h = yourImage.size
yourImage.crop((0, 30, w, h-30)).save(...)