Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from PIL import Image
- def split(path, input, height, width):
- im = Image.open(input)
- k = 0
- 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:
- a.save(path+"VanGogh_fake_{}".format(k)+'.jpg')
- except:
- pass
- k +=1
Add Comment
Please, Sign In to add comment