7

I'm building a program which reads photos off an SD Card then resize the images and upload them to Flickr (note, it's a second SD Card reader, not the one on-board)

The photos are high-resolution JPG's. An example photo is a 8.1 MB JPG from a Canon Rebel T4i. They could possibly be of even higher resolution.

I want to upload a preview photo of eg ~100-150KB immediately after reading the photos in from the SD Card. The speed of the resize and upload is more important than high quality, though of course the the image should be recognizable.

For now, I've used imagemagick, and have tested numerous variables to increase the speed, including overclocking, using an additional USB-stick or storage, etc.

I'm currently getting down to ~6 seconds to resize the 8.1 MB to a ~150KB JPG. This is using the "sample" option, with a 10%/170KB resulting JPG. The output quality is high, in fact higher than it needs to be, but even when I reduce the quality the duration stays the time.

Any ideas for ... a) further improving the speed of the imagemagick convert (or maybe other imagemagick option) ? b) other tool/library? c) something entirely different?

I did a write up of my efforts so far here: http://blog.sunekaae.com/2013/04/imagemagick-resize-speed-on-raspberry-pi.html

  • From your blog post I can see that you did test two different mediums but both are SD cards. Did you try resizing it on tmpfs to really remove medium read/write from the workload? – Krzysztof Adamski Apr 2 '13 at 7:50
  • will give that a try. but want to clatify that the second medium I tried was actually a USB stick. – Sune Kaae Apr 2 '13 at 15:26
8

You could try epeg. It's designed exactly for the job you need - to create fast thumbnails from jpeg files. The only problem is, you need to compile it yourself as there is no package for it for RaspberryPi. It's a library but it comes with a simple test tool that you can use.

  • From the github page: "Insanely fast JPEG thumbnail scaling with the minimum fuss and CPU overhead" ... sounds promising - will gave that a try... – Sune Kaae Apr 2 '13 at 15:27
  • 1
    just did an initial test, and the epeg command does indeed seem to be insanely fast. and it creates a high quality image with a small size. 1.0 second on average, with the same 10% target size. This seems like a winner. Thanks a lot! – Sune Kaae Apr 3 '13 at 3:58
  • 2
    It's working great so far. Wrote it up here: blog.sunekaae.com/2013/04/… thanks Krzysztof! – Sune Kaae Apr 3 '13 at 5:33
  • It's really fast, but the quality isn't that good since there is no antialiasing. Very blocky. But it may be enough for previews. – Daniel F Aug 29 '14 at 11:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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