ImageMagick is a powerful set of tools used to perform various operations on images directly from the command-line. To install it in Debian type as root:
apt-get install imagemagick
Or in Ubuntu:
sudo apt-get install imagemagick
With the user password.
Resize images using convert
The tool we're going to need for this is convert, which is included in the imagemagick package. Here's one easy way to do it:
convert -sample 50%x50% input_image.png output_image.png
This will resize the input_image.png and make it half the original image.
Another tool which does the same thing is mogrify, with the exception that it will overwrite the original image:
mogrify -resize 320 filename.jpg
This will resize filename.jpg using a width of 320 and keeping the aspect ratio intact.