How to easily resize images via command-line?
First install ImageMagick via:
sudo apt-get install imagemagick
Open a terminal and run this command:
convert -resize 20% source.png dest.jpg
It will reduce the size to 20%.
Note that the reduction is not by 20%.
The resulting image will be much smaller, 20% of the former size,
not 20% smaller than before, not much smaller.
You can also specify the size:
convert -resize 1024X768 source.png dest.jpg
You can also use: mogrify
command-line tool from the same package.
You want simple?
Run sudo apt-get install nautilus-image-converter
, or click nautilus-image-converter
.
It adds two context menu items in nautlius so you can right click and choose "Resize Image". (The other is "Rotate Image").
You can do a whole directory of images in one go if you like and you don't even have to open up an application to do so.
You need to restart your nautilus to see new context menus, run nautilus -q
and then click the Home folder icon to reload nautilus with the new plug-in.
sudo apt-get install imagemagick
The command mogrify
overwrites the original files with the resized images:
mogrify -resize 50% *.png # keep image aspect ratio
mogrify -resize 320x240 *.png # keep image aspect ratio
mogrify -resize 320x240! *.png # don't keep image aspect ratio
mogrify -resize x240 *.png # don't keep image aspect ratio
mogrify -resize 320x *.png # don't keep image aspect ratio
Note: You can add -auto-orient
to automatically orient converted images.