Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- from PIL import Image
- imdir = "directory of images"
- savedir="path to where you wanna save the files"
- files = [os.path.join(imdir, fname) for fname in os.lsdir(imdir)]
- for infile in files:
- im = pil.Image.open(infile)
- file, ext = os.path.splitext(infile)
- //first region
- slice1 = im.crop((left, upper, right, lower)
- slice.save(file+"slice1", "JPEG")
- //copy and paste with new boxes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement