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.

1 Answer 1

3

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.

1
  • 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, 2018 at 12:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .