- Convert a png file to jpg file
convert image.png image.jpg
- Convert all png files to jpg files
mogrify -format jpg *.png
or loop version
for i in .png ; do convert "i" "{i%.}.jpg" ; done
or xargs version with name-mangling
ls -1 .png | xargs -n 1 bash -c 'convert "0" "{0%.}.jpg"'
or parallel version
ls -1 *.png | parallel convert '{}' '{.}.jpg'
- Rescale the images
convert -resize 50% screen.jpg
convert -resize 600x600 screen.jpg:
1920x1200 => 600x375
600x1200 => 300x600
150x300 => 300x600
300x150 => 600x300
mogrify -resize 600x600> *.jpg:
1920x1200 => 600x375
600x1200 => 300x600
150x300 => 150x300 (is not resized to bigger size)
300x150 => 300x150 (is not resized to bigger size)