Stuff
public text v1 · immutableimport sys
from vipsCC import *
tilesize = 20
try:
im = VImage.VImage (sys.argv[1])
# loop to create the tiles
for y in range (0, im.Ysize(), tilesize):
for x in range (0, im.Xsize(), tilesize):
filename = 'x_%d_y_%d.jpg' % (x / tilesize, y / tilesize)
# clip tilesize against image size
width = min (im.Xsize () - x, tilesize)
height = min (im.Ysize () - y, tilesize)
im.extract_area (x, y, width, height).write (filename)
except VError.VError, e:
e.perror (sys.argv[0])