1

How to automatically crop and cut an image into several images using ImageMagick?

Hello,

Let's say I have an image with four circles of slightly different shape like so:

O o
o O

Is there a way to make ImageMagick automatically crop, cut and save the picture into four images like so:

Pic 1: O
Pic 2: o
Pic 3: o
Pic 4: O

Vesa

Update: I would prefer if an algorithm automatically figured out which parts of the image are most likely to belong together and crop accordingly. I think Inkscape has some kind of algorithm like that.

2

If you simply need the images split into four ordered parts, you can use tile cropping like so:

convert -crop 2x2@ -scene 1 image.jpg cropped_%02d.jpg

This will split the image into four roughly equal tiles numbered from 01-04, from upper left to lower right.

  • Update: I would prefer if an algorithm automatically figured out which parts of the image are most likely to belong together and crop accordingly. I think Inkscape has some kind of algorithm like that. – Vesa Mar 29 '18 at 12:42

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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