Epeg
We can download EPEG source code and compile it without e17 (needs only libjpeg). After compile and install there will be an app called "epeg", but we will make our own, with epeg.c file like this: To compile it use:gcc epeg.c -o epeg `epeg-config --cflags --libs`
And the compile "epeg" binary can be used like this:
./epeg -i file.jpg -o thumb.jpg -h heigth -w width -q quality
PIL
Python Imaging Library - the thing you would use in Python to make thumbs. It also has some filters like ANTIALIAS and SHARPEN which increase the quality of the thumbnails. Test script looks like this:Benchmark settings
- I've measured time (bash/time) needed to make thumbs from 18 big JPEG files (35 MB).
- For every tested library a simple bash script was used. For imagemagick:
- EDIT: in case of imagemagick also -size param should be set so imagemagick would only read needed part of file to create the thumb, and not the whole.
- All libraries were ordered to make the same thumbs with the same settings (quality, width, heigth).
Making Python modules from EPEG in C and C++/BOOST
We can use Python standard API in C to make a Python module. The code would look like this: And compiled with (-fPIC needed on 64 bit Linux):gcc -shared -I /usr/include/python2.5/ epg.c -o epg.so -fPIC `epeg-config --cflags --libs`
We can also use C++ and BOOST/Python. The code would look like this: Compiled with (-fPIC needed on 64 bit Linux):
gcc -lboost_python -shared -I /usr/include/python2.5/ bstepg.cpp -o bstepg.so -fPIC `epeg-config --cflags --libs` -I/usr/include/boost
The results
- EPEG - 4,15s
- PyEPEG C - 4,54s
- PyEPEG BOOST - 4,58s
- PIL - 11,61s
- IMAGEMAGICK - 29,32s
- IMAGEMAGICK -size - 10,9s (edit/update)

| Description | Epeg | PIL | ImageMagick |
|---|---|---|---|
| Big image 1,3 MB, 2560x1600 |
![]() 8,5kB |
![]() 8,1kB |
![]() 10,1kB |
| Small image 27 kB, 300x506 |
![]() 8,5kB |
![]() 8,5kB |
![]() 8,3kB |









