0 کاربر و 1 مهمان درحال مشاهده موضوع.
from PIL import Imageimport Imagedef crop(Path,input,height,width,i,k,page,area): im = Image.open(input) imgwidth, imgheight = im.size for i in range(0,imgheight,height): for j in range(0,imgwidth,width): box = (j, i, j+width, i+height) a = im.crop(box) try: o = a.crop(area) o.save(os.path.join(Path,"PNG","%s" % page,"IMG-%s.png" % k)) except: pass k +=1