Reputation: 39859
Using ImageMagick, I can easily have a screenshot of what I want, but I'd like to resize it for using less space. I found this :
convert screen.jpg -resize 1280x1024\! screen.jpg
But I'd like to resize it based on the most bigger size (width OR height) and the other one (height OR width) will be proportionnaly resized too.
For example, say I want all my image to be resized to 600px at their most width/height size :
How can I do that with ImageMagick? (or at least, defining one max size (only width for example)).
Thanks for your help!
Note: is it possible to implement it automatically with the import
command?
Upvotes: 32
Views: 29738
Reputation: 2678
To preserve aspect ratio:
convert -resize 600x600 screen.jpg:
convert -resize 600x600\> screen.jpg:
Upvotes: 65
Reputation: 971
To preserve aspect ratio, you can shrink the image by a certain scale:
convert -resize 50% screen.jpg
Or use a pixel area:
convert -resize 180000@ screen.jpg
This would also blow up small images to the specified area. If you want ImageMagick to shrink your large images but keep small images untouched, use the ">" operator:
convert -resize '180000@>' screen.jpg
Note that you then need to quote the geometry argument in order to prevent your shell interpreting the ">" sign as a file redirectors.
See ImageMagick documentation for these and other options: http://www.imagemagick.org/script/command-line-processing.php#geometry
Upvotes: 28