Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chop image into 4*4 tiles with Imagemagick

I am trying to figure out if it is possible to chop an image into 4*4 tiles equally (i.e so you create 16 images from every single image).

I know it is possible, but cannot figure out the command.

like image 739
Simon Kiely Avatar asked Nov 19 '25 08:11

Simon Kiely


1 Answers

With ImageMagick you can use the "-crop" operator in several ways. To cut the image into 16 pieces, 4 tiles by 4 tiles, try this command...

convert input.png -crop 4x4@ +repage output%02d.png

That will create 16 output images named "output00.png", "output01.png", etc. Keep in mind if the input image width or height is not evenly divisible by 4, the output images may not be identical dimensions. They will, however, always be plus or minus 1 pixel of the same.

To start numbering at 01 instead of 00, put "-scene 1" just before the name of the output.

like image 86
GeeMack Avatar answered Nov 21 '25 04:11

GeeMack



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!