Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go


The command line mogrify is excellent for modifying an image: resize, rotate, recolour, etc. Unlike convert, mogrify will overwrite the input file.

Resize an Image

$ mogrify -geometry

This will maintain the image's aspect ratio (the specified width and height are maximum values). To force a change to the aspect ratio append the geometry with an exclamation point.

Rotate an Image

$ mogrify -rotate "-90" test.jpg

Reduce Colours

$ mogrify -colors 2 <filename>

Reduce and Dither Colours

$ mogrify -colors 4 -dither <filename>


$ mogrify -monochrome <filename>

Annotate Image

$ mogrify -comment 'My holiday highlight' <filename>


$ mogrify -border 2x4 <filename>

This adds a border of 2 pixels wide and 4 pixels high.

Decorative Border

$ mogrify -frame 20x20 <filename>

Copyright © 1995-2019 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware and the author of open source software including Rattle and wajig.
Also the author of Data Mining with Rattle and Essentials of Data Science.