7

In my last question I asked whether there was a better way to rotate images than I had thought of. I ended up discovering jpegtran and have since found libjpeg-turbo.

Now I am looking for a better way to resize the images (jpegs) than imagemagick and graphicsmagick.

Is there a specialized commandline tool to resize the images in a more efficient way than imagemagick or graphicsmagick? Maybe the resizing can be done on the GPU using opencl or opengl?

The provided hardware is the same as in the other post:

  • Intel Atom D525 (1,8 Ghz)
  • Mobility Radeon HD 5430 Series
  • 4 GB of RAM
  • SSD Vertility 3
Community
  • 1
  • 1
Thomaschaaf
  • 17,847
  • 32
  • 94
  • 128
  • Did you try `cjpeg` from libjpeg-turbo? Seems like that should have similar performance improvements. Rather than spawning a command-line utility for each jpeg you should also be able to improve speed by using the libjpeg-turbo library directly. – Stennie Aug 12 '12 at 07:59
  • 2
    instead of stating some random requirements (efficiency is such an abstract item), say what limit bothers you currently and where you want to get. Also, it would be nice to know what is the actual *current* bottleneck (this can be read,write,en-/decode or the actual transform). – KillianDS Aug 16 '12 at 14:07

5 Answers5

5

Check this link out: http://leocharre.com/articles/faster-image-resizing-in-linux/

In particular the author mentions that imgresize is faster than imagemagick, and epeg is extremely fast.

epeg (http://www.systhread.net/texts/200507epeg1.php) seems quite well documented for generating thumbnails. If the quality is good enough, this could be the solution.

ronalchn
  • 12,225
  • 10
  • 51
  • 61
  • 1
    Thank you! Scaling an image used to take ~2 sec (r: 2.000s, u: 5.632s, sys: 0.1s) now it takes ~0.8 sec (r: 0.821, u: 0.756, sys: 0.048s). Thats less than half the time :) – Thomaschaaf Aug 19 '12 at 12:55
3
  • OpenCL is a standard for cross-platform, parallel programming of modern processors found in personal computers, servers and handheld/embedded devices. It's directly supported by ATI. You'll need to get AMD APP SDK (formerly known as AMD Stream SDK) to get GPU support (also check out this getting started guide).

  • Take a look at Intel's IPP - Integrated Performance Primitives. It's a multi-threaded software library of functions for multimedia and data processing applications. Among other features, it's has functions to resize images (bilinear, nearest neighbor, etc). Unfortunately, it is not free (cheapest version costs $199).

  • VIPS is a free image processing system. It claims that compared to most image processing libraries, VIPS needs little memory and runs quickly, especially on machines with more than one CPU. See the Speed and Memory Use page for a simple benchmark against other similar systems.

djf
  • 6,592
  • 6
  • 44
  • 62
  • Thank you I have checked out VIPS but the performance is not good: # time gm convert -size 600x400 a.jpg -resize 600x400 b.jpg real 0m0.239s user 0m0.192s sys 0m0.008s # time vips im_resize_linear a.jpg b.jpg 600 400 real 0m0.854s user 0m0.692s sys 0m0.100s This is on a much faster system. On the Atom this takes about 5 times longer.. – Thomaschaaf Aug 18 '12 at 09:07
  • You need to use vipsthumbnail. Eg. `$ time gm convert -size 600 wtc.jpg -resize 600 b.jpg real 0m0.271s user 0m0.368s sys 0m0.020s $ time vipsthumbnail wtc.jpg --size 600 --output b.jpg real 0m0.270s user 0m0.272s sys 0m0.016s`. The differences are small with jpeg, since it can be shrunk so quickly on load, but you'll see a huge difference with formats like tif and png. – jcupitt Mar 08 '13 at 23:21
1

You can actually do a lot of bulk processing like this with GIMP's CLI options.

http://www.gimp.org/tutorials/Basic_Batch/

BoeroBoy
  • 1,094
  • 11
  • 17
0

There is also djpeg and cjpeg from the Independent JPEG Group which can rescale and image to an M/N fraction. Not perfect but very fast.

bytespider
  • 586
  • 5
  • 6
-1

Simply use FFMpeg.exe. It can resize , convert , change quality and so on. And also it works with almost all known types of videos/audios/pictures. It works in linux/unix too, and there is open source code for it written in C++. You can get it Here (for Windows/compiled exe) or Here (source code and so on).
If you are developing a program, I recomend you to use standard GDIPlus library. It does everything with pictures.

Searush
  • 628
  • 1
  • 5
  • 18