How to split images using ImageMagick

imagemagicksplit

I have an image which contains multiple images in it. I want to split the image into multiple image files, one file per image. How do I do this using ImageMagick?

I have attached a sample image file.

Image file with multiple image within it

Best Answer

To simply split your image into quadrants (same size) use crop+repage:

convert image.jpg -crop 50%x50% +repage piece_%d.jpg

If you need different size quadrants you could cut around a single point:

convert image.jpg -crop 240x280+0+0 +repage piece_1.jpg
convert image.jpg -crop 0x280+240+0 +repage piece_2.jpg
convert image.jpg -crop 240x0+0+280 +repage piece_3.jpg
convert image.jpg -crop +240+280 +repage piece_4.jpg

enter image description here

Related Question