I've been working with ImageMagick on the Raspberry Pi (model B) and have noticed a bottle neck in the area of image conversions.

When converting between bmp, jpg, png, etc. the speeds are acceptable but I also have a need to convert RAW formats.

In particular, I have been converting NEF to jpg at 70% for benchmark tests.

The Raspberry Pi takes just over 5 minutes to convert a single 12.7 MB image compared with 14 seconds on my Ubuntu Laptop.

Of course, I understand the limitations of the Pi's hardware but I am very interested in how I can really get the most from the performance.

I already know about overclocking and intend to implement this tomorrow when I work on it next.


  • Raspberry Pi uses heavily modified version of Raspbian (lightweight, no X, unnecessary software stripped out, running Apache, running own software)
  • A class 10 4GB SD card is used
  • Benchmarks taken without overclocking
  • Totally headless

Some things I am considering:

  • Overclocking

  • Finding another piece of software which may be able to perform conversions on raw faster

  • Trying to find a way to utilise the GPU as well as the CPU (possibly forking the necessary code for conversions and attempting modifications to use GPU)

  • Allocating all possible RAM to CPU

Any help is greatly appreciated, whether it be advice on optimisations or another piece of software that could be used.

I don't expect it to be as fast as a laptop but ideally the speed would increase to around 1 - 2 minutes per image.

1 Answer 1


Five minutes? You sure are doing something wrong (or are using some CPU-intensive options that you haven't told us about). For me, the command

gm convert -quality 70 DSC_1432.NEF DSC_1432.jpg

takes 53 s on a stock Raspberry Pi. The image is a 12 MB, 12 mpx file from my Nikon D90.

A quicker, simpler workflow is to use a pipeline of two simple command line tools, dcraw and cjpeg, which you can install like this:

sudo apt-get install dcraw libjpeg-progs

and run like:

dcraw -c DSC_1432.NEF | cjpeg -qual 70 > DSC_1432.jpg

This takes 50 s on my Raspberry Pi.

If you're willing to sacrifice some image quality (and if you're batch-converting RAW→JPEG without some knowledge of the contents, you're probably not too fussed about the JPEG quality), this is much faster still:

dcraw -q 0 -c DSC_1432.NEF | cjpeg -qual 70 > DSC_1432.jpg

This converts an image in 24 s.

Fastest of all — but resulting in a half-sized output image — is:

dcraw -h -c DSC_1432.NEF | cjpeg -dct fast -qual 70 > DSC_1432.jpg

This converts an image in just 9 s.

  • This works fantastically, thank you. I was using imagemagick instead but I have no idea what was causing the slow down. Your solutions work nicely!
    – Arcana
    Aug 7, 2014 at 9:56
  • Ah, now that I try ‘real’ ImageMagick, it takes about four minutes for the first example. I'd assumed that Raspbian was like Ubuntu, where ImageMagick had been replaced by the more open-source-friendly GraphicsMagick fork. But seemingly, no.
    – scruss
    Aug 7, 2014 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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