Guest User

Untitled

a guest
Jan 17th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. from PIL import Image
  2.  
  3. def split(path, input, height, width):
  4. im = Image.open(input)
  5. k = 0
  6. imgwidth, imgheight = im.size
  7. for i in range(0,imgheight,height):
  8. for j in range(0,imgwidth,width):
  9. box = (j, i, j+width, i+height)
  10. a = im.crop(box)
  11. try:
  12. a.save(path+"VanGogh_fake_{}".format(k)+'.jpg')
  13. except:
  14. pass
  15. k +=1
Add Comment
Please, Sign In to add comment