How to Crop an Image into Tiles with ImageMagick?

This article provides a quick overview and practical guide on how to use the ImageMagick convert command to slice a single image into a grid of smaller, equal-sized tiles. You will learn the exact syntax for the -crop geometry option, how to handle image positioning, and how to automatically number the outputted image files.

The ImageMagick Slicing Syntax

To split an image into a grid of smaller tiles, you use the convert command paired with the -crop option. The basic syntax requires you to define the target width and height of the tiles, followed by a percentage sign or an @ symbol depending on how you want to split the image.

Here is the standard command to slice an image into specific pixel dimensions:

convert input.jpg -crop 100x100 +repage tile_%d.jpg

Syntax Breakdown

Alternative Slicing: Grid by Equal Segments

If you do not know the exact pixel dimensions but instead want to divide the image into an equal number of rows and columns (for example, a 3x3 grid), you can add the @ symbol to your geometry arguments.

convert input.jpg -crop 3x3@ +repage tile_%02d.jpg

In this variation, 3x3@ tells ImageMagick to divide the image into 3 equal columns and 3 equal rows, resulting in 9 total tiles. The %02d format string ensures that the output filenames use two-digit, zero-padded numbering (e.g., tile_00.jpg, tile_01.jpg), which keeps your file directory cleanly organized.