0

From How to easily resize images via command-line? I know I can use this command to resize an image in bash:

convert -resize 1024X768  source.png dest.jpg

But I'm stuck at only providing the width and keeping the aspect ratio.

man convert does not provide any help for -resize flag.

I want something like convert -resize 1024 -keep-ratio source.png dest.png

What would be the command?

Saeed Neamati
  • 793
  • 2
  • 7
  • 20

1 Answers1

2

convert -resize by default does keep the aspect ratio (unless ! is specified). So to resize based on width alone you would just need to do: convert -resize 1024 source.png dest.png

To convert based on the height alone for example: convert -resize x768 source.png dest.png

-resize takes the Geometry parameter. Take a look at the docs I linked as well as resize examples.

codlord
  • 2,506