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

Resize an Image

20190428 To re-scale a photo (or any image) that might be too large for sending by email, for example, or too large to include in a presentation:

$ convert -resize 800x600 img.jpg imgs.jpg

This can also be done in-place:

$ mogrify -resize 800 img.jpg

A percentage can be specified instead and is generally simpler, retaining the aspect ratio:

$ convert -resize 25% img.jpg imgs.jpg

The following example 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:

$ mogrify -geometry

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.