Search code examples
imagemagickcropmogrify

imagemagick mogrify cut part of image out


If I have an image similar to this:

---------------------------------
-        xxxxxxxxxx             -
-        x        x             -
-        xxxxxxxxxx             -
---------------------------------

How can I use mogrify to cut out just the portion in x's? Do i use -geometry?. I can't find a good example.


Solution

  • The imagemagick docs show how to do so with "convert":

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

    There are variations, depending on whether you want to replace the "cut" portion with another color or trim the size down to just the x's (in your diagram).

    I'm assuming "mogrify" will do the same thing, but you just don't give an output filename.