Resize a picture using the terminal

Resize a picture using the terminal

It is rather easy to do basic picture manipulations using the shell. The tool imagemagick is extremely powerful and is part of the apt system, so it is easy to install with
[shell]
sudo apt-get install imagemagick
[/shell]

In order to resize a jpg picture (called here: pictureIn.jpg) then to a certain width (e.g. 2000px) and maintain the width/height ratio it is enough to type

[shell]
convert pictureIn.jpg -resize 2000 pictureOut.jpg
[/shell]

At the same time it would be possible to reduce the quality of the resulting picture, to further reduce the file size. For that the command would be

[shell]
convert pictureIn.jpg -resize 2000 -quality 90 pictureOut.jpg
[/shell]

Leave a Reply

%d bloggers like this: