How to resize images from the console

We can resize our images from the command line using convert command from imagemagick. Install it if you dont have imagemagick:

sudo apt-get update
sudo apt-get install imagemagick -y

To resize an image with maximun width 800 pixels and maximun height 600 pixels but keeping the aspect ratio:

convert image.png -resize 800x600 resized.png

To get the resolution of an image:

identify -format "%wx%h" resized.png