Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have 10k+ GIF files that I need to convert to PNG or JPEG preferably using command line so that I can automate it. I'm not worried about losing quality or transparency, just need to prepare files for OCR software.

When trying to use convertformat, I get this:

Error in pixReadStreamGif: function not present
Error in pixReadStream: gif: no pix returned
Error in pixRead: pix not read
Error in pixGetDepth: pix not defined
Error in pixWrite: pix not defined

Any ideas?

share|improve this question
up vote 28 down vote accepted

No need for any additional tools. OS X has sips, which can convert images to (almost) any format.

For example, to convert every .gif to .jpeg, putting them into a folder called jpegs:

mkdir jpegs
sips -s format jpeg ./*.gif --out jpegs

Or, to recursively convert them using find, which will place a JPEG file with the same name as the GIF next to it.

find . -iname "*.gif" -type f -exec sh -c 'sips -s format jpeg "$0" --out "${0%.gif}.jpeg"' {} \;
share|improve this answer

Rather old question I see, but unfortunately the slhck's solution two doesn't work for me (OS X Mountain Lion, bash) I get an error.

This one works for me (after cd my_dir_with_gif command of course):

for i in *.gif; do sips -s format jpeg "${i}" --out "${i%gif}jpg"; done

And if you want to set the jpg compression as well ([low|normal|high|best|<percent>])

for i in *.gif; do sips -s format jpeg -s formatOptions 100 "${i}" --out "${i%jpg}png"; done

For other formats you should change extensions (remembering the sips jpg format is always jpeg, the extension could be .jpg)

This using sips but even better ImageMagick. It's a great tool, and I suggest to install it using brew see brew homepage

share|improve this answer

Check out GraphicsMagick or ImageMagick, they have command line tools for all sort of mangling of graphics files (including boring stuff like transforming to another format).

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.