Say I have a large 800x5000 image; how would I split that into 5 separate images with dimensions 800x1000 using the command line?
$ convert -crop 800x1000 image.png cropped_%d.png
Will create a sequence of files named
cropped_2.png, and so on.
Using the "tiles" functionality:
convert image.png -crop 1x5@ out-%d.png
ImageMagick would crash on me, for the image being too big for it to handle, so I had to resort to other methods.
I ended up using the Python Image Library.
A quick and dirty answer to the OP question follows:
from PIL import Image im = Image.open("YourImage.yourformat") for h in range(0, im.height, 1000): nim = im.crop((0, h, im.width-1, min(im.height, h+1000)-1)) nim.save("PartialImage." + str(h) + ".yourformat")
The above code has the final sizes hardcoded, but it can be easily transformed into an full blow script of its own with all inputs parameterized. If one ever needs such a thing.