Back to the snippets index

Crop an image into pieces

( Anthony 21/6/2008 )

Crop an image into 200 x 200 pieces - you do get a remainder if the original does not divide exactly. The images will be in the format: image-0.jpg, image-1.jpg etc.

IM code:

<?php
exec
("convert input.jpg -crop 200x200 image-%d.jpg");
?> 

Image to go with Crop an image into pieces example code