How to resize a PNG file from the command line

image manipulation

Suppose I have a image named 1.png which is currently

500px : height
1000px : width

I want to resize it to:

50px : height
100px : width

It must be output in PNG format, not JPG. An example would be highly appreciated.

Best Answer

I'd use convert or mogrify from the ImageMagick suite.

$ convert -resize 100x50 1.png 2.png

# or #

$ mogrify -resize 100x50 1.png

convert takes a separate output filename; creating a separate file.
mogrify doesn't take a separate output filename; modifying the file in place

Related Question