Page 1 of 1

New to imagemagick, need to crop image into tiles.

Posted: 2012-06-27T10:44:32-07:00
by griduser64
I've read around and the command is,

convert -crop 32x32 terrain.png tiles/tile%03d.png

but no one ever mentions where to put the command, I've installed imagemagick and I run imagemagick display but there is no place for commands.

Re: New to imagemagick, need to crop image into tiles.

Posted: 2012-06-27T11:33:52-07:00
by fmw42
IM is primarily a command line driven system. You simply type the command in a terminal window or if using PHP, you can put the command line in an exec() call from PHP. You do not display the image first and work from the X display GUI for IM.

Syntax should be (assuming your terain.png is in the current directory from which you run the command and that tiles/ is a subdirectory of the current directory)

convert terrain.png -crop 32x32 tiles/tile%03d.png

However if you do not need to save the virtual canvas, add +repage after the crop 32x32.

see
http://www.imagemagick.org/Usage/crop/#crop

Re: New to imagemagick, need to crop image into tiles.

Posted: 2012-06-27T11:47:46-07:00
by griduser64
It worked! Thanks!

Re: New to imagemagick, need to crop image into tiles.

Posted: 2012-06-28T18:03:08-07:00
by anthony
More specifically

IM Examples, Tile Cropping
http://www.imagemagick.org/Usage/crop/#crop_tile