Install on Ubunutu

sudo apt-get -y install imagemagick

identify  image.png
file      image.png

Convert image

convert image.png -resize 300x400 new_image.png

See also Batch Resize Images using Linux Command Line and Imagemagick