Home > Design > Resources > Code >

crop away duplicate transparent background


import glob
import uuid
import os
from PIL import Image


fs = glob.glob('*.png')
for f in fs:
    im = Image.open(f)
    im = im.crop(im.getbbox())
#    im = im.resize((130, 130))
    im.save(f)