Skip to content

Instantly share code, notes, and snippets.

@rmamba
Created May 1, 2016 00:28
Show Gist options
  • Save rmamba/760686caac72e719dcb6b9493885e03e to your computer and use it in GitHub Desktop.
Save rmamba/760686caac72e719dcb6b9493885e03e to your computer and use it in GitHub Desktop.
from PIL import Image
size = 16
im = Image.open("cards-001.png")
w = 0
h = 0
while h + size < im.size[1]:
w = 0
while w + size < im.size[0]:
im.crop((w, h, w+size, h+size)).save('cards-001-%s-%s.png' % (h, w))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment