GNU/Linux Desktop Survival Guide
by Graham Williams |
|||||
Resize an Image |
20190428 To re-scale (resize or reduce the size of) 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 |
To force a resize without retaining the aspect ratio:
$ convert -resize 800x600\! img.jpg imgs.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 |