Question

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.

Was it helpful?

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.

OTHER TIPS

while the code is awesome their manual lacks serious examples. cut out your xxx section by specifying the start via ++ and the x before is the new image size of b.png, while a.png is the input.

mogrify -crop '100x200+100+10' -write b.png a.png

In this case it takes 100px to the right by 200 pixel down, with an offset of the window from the upper right anchor of a.png by 100 right and 10px down. simple once grasped.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top