Sun
20
Mar '11
Quickly convert images with ImageMagick
by Frank Spychalski filed under Braindump

I just spent a few minutes looking for a tool to convert a small number of PNG files to JPG on Mac OS. It was just a few dozen files but so in the end fell back to the good old command line because I don’t like graphical interfaces for these tasks.

For future reference:
for file in *.png; do jpg="$(basename \"$file\" .png).jpg"; convert "$file" "$jpg"; done

Yes, it’s that simple once you have installed ImageMagick.


3 Responses to “Quickly convert images with ImageMagick”

  1. 1

    wow! Mac users can still use the command line! I’m impressed ;-)

    schlumpf (March 20th, 2011 at 15:09)
  2. 2

    Instead of ImageMagick you could you use sips (scriptable image processing system). This is installed by default on Mac OS.
    for ex. sips -s format jpeg “$file” –out “$jpg”

    Hans verschooten (March 20th, 2011 at 16:14)
  3. 3

    Thanks I have to try this.

    Additionally Mike suggested on FB:

    for file in *.png; do convert "$file" "${file%.png}.jpg"; done

    Frank Spychalski (March 20th, 2011 at 16:23)

Any comments? Or questions? Just leave a Reply: