Jason Van Anden wrote: > I am trying to take an existing image and split it into equally sized > tiles. When I try to save a "cropped" image I get the following > error: > > "tile cannot extend outside image" > > The first pass saves the first tile correctly, the second one chokes > and blurts the error. > > Following is some code to illustrate my confusion: > > original_image = Image.open("big_image.tif") > > # math stuff > w, h = orig.size > self.tile_width = w = w/self.tiles_across > self.tile_height = h = h/self.tiles_down > > for y in range (self.tiles_down): > > for x in range (self.tiles_across): > > box = (x * w, y * h, w, h) > tim = original_image.crop(box) > tim.save("test.tif") > > Advice super appreciated! > > Thank You ~ j > Crop uses right and lower instead of width and height for the last two elements of the box.
crop *im.crop(box)* => image Returns a rectangular region from the current image. The box is a 4-tuple defining the left, upper, right, and lower pixel coordinate. - Ken _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig