• Convert several files from a format to another:

    $ convert img_*.bmp img_%04d.png
  • Resize images of the current folder to progressive jpeg. Resized images will not be greater than 600x600, but the aspect ratio will be respected:

    $ convert -resize 600x600 -sharpen 1 -interlace Line * pict%04d.jpg
  • Remove all metadata of a JPEG file:

    $ exiftool -all= image.jpg
  • Prefix all JPEG filename with their EXIF date:

    $ for i in *.jpg; do exiv2 -v -r '%Y%m%d_%H%M%S_:basename:' rename "$i"; done
  • Remove recursively (and in-place) the color profile and comments embedded in all PNG images:

    $ mogrify -verbose -monitor -strip ./*.png
  • Massive in-place optimization of all PNG images available in sub-directories:

    $ find ./ -iname "*.png" -exec pngcrush "{}" "{}.crushed" \; -exec mv "{}.crushed" "{}" \;
  • Same as above, but remove all known chunks, those encoding color profiles, gamma and text, and only keeps transparency chunks:

    $ find ./ -iname "*.png" -exec pngcrush -rem alla "{}" "{}.crushed" \; -exec mv "{}.crushed" "{}" \;
  • Lossless optimization of JPEG files:

    $ find . -iname "*.jpg" -exec jpegtran -optimize -outfile "{}.optimized.jpeg" "{}" \;

Related content