in Art, Web and Tech

CLI, Batch Image Format Conversion

Here’s a neat trick to convert an image or batch convert a bunch of images from an Ubuntu CLI using ImageMagick.

Single File:

convert image.png image.jpg

Create thumbnails from all images in current directory:

for img in `ls *.jpg`
do
  convert -sample 25%x25% $img thumb-$img
done

Batch convert with the ImageMagick mogrify tool:

mogrify -format jpg *.png
magick mogrify -resize 50% rose.jpg
magick mogrify -resize 256x256 *.jpg

More usage examples may be found here:
https://www.ibm.com/developerworks/library/l-graf/?ca=dnt-428

Write a Comment

Comment