Example 1: crop PNG image to its minimum size
from PIL import Image
im = Image.open("2.png")
im.size # (364, 471)
im.getbbox() # (64, 89, 278, 267)
im2 = im.crop(im.getbbox())
im2.size # (214, 178)
im2.save("2.png")
Example 1: crop PNG image to its minimum size
from PIL import Image
im = Image.open("2.png")
im.size # (364, 471)
im.getbbox() # (64, 89, 278, 267)
im2 = im.crop(im.getbbox())
im2.size # (214, 178)
im2.save("2.png")