Date

Say you're making a map and your base .png is a monster. Too big to host anywhere for free. Never fear, ImageMagick is here! Slice that beast up, send it through the ether, and stitch it back together on the other side.

Slice Images

convert monster.png -crop wxh %04d.png

Where 'w' and 'h' are the width and height of each tile you want to create.

For example, if I have a map that is 64000x20275 pixels, I would run:

convert map.png -crop 8000x4055 %04d.png

This will generate 40 .png's each 8000x4055 pixels.

Stitch Images

You stitch images back together using append. There are two switches available: '+' for horizontal '-' for vertical

In the example above, I stitch the array of images back together like so:

convert \( 01.png 02.png 03.png 04.png 05.png 06.png 07.png 08.png +append \) \
          \( 09.png 10.png 11.png 12.png 13.png 14.png 15.png 16.png +append \) \
          \( 17.png 18.png 19.png 20.png 21.png 22.png 23.png 24.png +append \) \
          \( 25.png 26.png 27.png 28.png 29.png 30.png 31.png 32.png +append \) \
          \( 33.png 34.png 35.png 36.png 37.png 38.png 39.png 40.png +append \) \
          -append ../map.png