5

I'm trying to crop an image into a bunch of 256x256 tiles (with the right-most and bottom-most images less than 256 pixels due to the remainders), but ImageMagick always generates images that are 1x1.

I use this command (Windows 7 command prompt):

convert WBS.png -crop 256x256 +repage +adjoin output\WBS_%02d.jpg

After cropping the following message is displayed:

convert: geometry does not contain image `WBS.png' @ warning/transform.c/CropImage/589.

After cropping, the output folder contains 1634 jpg files, all of which are 1 x 1 pixel. The source image is 7218x7650.

Suggestions? I'm sure I'm making some blatant mistake, but I don't know what it is.

1 Answer 1

5

This can happen if the origin of the image is not at 0,0. In that case, using +repage before processing the image should do the trick, i.e.

convert WBS.png +repage -crop 256x256 +repage +adjoin output\WBS_%02d.jpg

See also the documentation of the -crop option.

1
  • 1
    The additional repage did it. Thanks, SMeyer.
    – Steve A
    Commented Nov 30, 2016 at 2:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.