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'm looking for the fastest command-line image converter for Linux which can read a JPEG image, scale it down to at most 1366x768, and write a quality 50 JPEG image. Something like this, but much faster than ImageMagick:

$ convert -resize x768 -quality 50 foo42.jpg
# takes 0m16.713s for my test image set

I've also tried this:

$ <foo42.jpg djpeg | pnmscale -xysize 1366 768 | cjpeg -quality 50 >
# takes 0m12.007s for my test image set, and has lower visual quality than ImageMagick

So I'd like to have a program, preferably written in C, which integrates djpeg, a higher quality version of pnmscale, and cjpeg.

I've just found swiggle (a C program using libjpeg), I've disabled some of it's functionality I don't need in the source code, and I've got:

$ swiggle -f -H 768 .
# takes 0m11.378s for my test image set, yields high quality results

Do you have another suggestion? I guess most image converters use libjpeg, so it would be hard to get much faster results than swiggle.

share|improve this question
I guess the fastest would make use of CUDA or OpenCL (which use the power of your NVidia or AMD based GPU). I think OpenCV now uses CUDA in parts. You might be able to whip something up if you're handy with c – Matt H Feb 24 '11 at 2:44
I agree with Matt. If those are huge images (and if it takes 12 seconds then I guess they are not small), then CUDA/OpenCL would do the job. Or get a better PC. – Shiki Feb 24 '11 at 6:15
The images are not too large (4000x3000 is the maximum) -- conversion takes 12 seconds for an image set of several dozen images. – pts Mar 11 '11 at 10:39

The fastest library I've used so far is definitely EPEG. It can only create thumbs from JPG files, but it creates them very fast:

$ identify worldmap.jpg
worldmap.jpg JPEG 6400x3200 6400x3200+0+0 DirectClass 8-bit 6.85727mb 0.840u 0:02


$ time convert -resize 1536x768 -quality 50 worldmap.jpg im_thumb.jpg
# 2.93s user 0.23s system 85% cpu 3.718 total


$ time epeg -w 1536 -h 768 -q 50 worldmap.jpg epeg_thumb.jpg
# 0.31s user 0.01s system 79% cpu 0.404 total

I used this library to create thumbs for a vast amount of really large images.

share|improve this answer
2 ... check out this fork, too. – mattes Aug 27 '14 at 10:02
up vote 1 down vote accepted

I've solved this problem by downloading swiggle (a command-line JPEG thumbnail + HTML image gallery generator), and modifying its source for my needs. See the speed measurements in the question (less than 10% faster than djpeg+pnmscale+cjpeg).

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.