36.30 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, we can simply specify a percentage, thus retaining the aspect ratio of the image:
convert -resize 25% img.jpg imgs.jpg
We can resize an image down to a size that will fit within the
specified bounds, like
800x600. Depending on the aspect ratio of the
original image, the resulting image will be exactly 800x600, or its
width will be 800 or its height 600.
convert -resize 800x600 img.jpg imgs.jpg
If a single size is specified then either the width or the height is reduced to that size, which we can do in-place with:
mogrify -resize 800 img.jpg
To force a resize without retaining the aspect ratio:
convert -resize 800x600\! img.jpg imgs.jpg
Your donation will support ongoing availability and give you access to the PDF version of the book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2021 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0.