From: Marc Liyanage <liyanage@access.ch>
Date: January 18, 2004 3:53:34 PM PST
To: Cocoa Development <cocoa-dev@lists.apple.com>
Cc: raster@rasterman.com
Subject: ANN: EpegWrapper: Wraps the epeg library for very fast JPEG
thumbnail generation
Carsten Haitzler ("rasterman" of Enlightenment fame) wrote a cool
little library called "epeg" for very fast JPEG image thumbnail
generation.
He writes:
Over the last few days I have addressed something that bothered me
greatly while fixing up my web pages. The INSANELY SLOWspeed of
generating thumbnails for photos.
First, some background. I have a large photo collection. Definitely
not the biggest as I can imagine some people have even more extensive
collections. I have something like 1300 photos, most of which are
2560x1920 in size. By any stretch this isn't small. When making
thumbnails of these images, under Nautilus on my machine the process
would take about 1 second per photo. That's a lot of time to
thumbnail my collection. Yes they get cached, but every time you
rename or move files around they need re-thumbnailing. This really
got to me. So I started using Imlib2 for thumbnailing. Great. This
gave about a 2-3 times speedup, letting me do about 2 to 3 thumbnails
per second. But that just wasn't good enough. I knew I could do
better, thus my work on what I now call Epeg was born.
Epeg can thumbnail at about 25 thumbnails per second. Compared to the
original speed of Nautilus... this is a decent speedup and worth the
effort of using Epeg. Epeg is a library with a small API that lets
you load a JPEG file, scale it down (on load) append comments and
thumbnail info, save, access the scaled pixel data, load comments and
thumbnail info etc. It's small, compact and fast and it's only
requirement is libjpeg.
I used this in a project and created a very simple Objective-C wrapper
class which takes a JPEG file path, a bounding box and returns an
NSImage instance:
#import "Epeg/EpegWrapperPublic.h"
+ (NSImage *)imageWithPath:(NSString *)path
boundingBox:(NSSize)boundingBox {
This will scale down the image proportionally so it fits into the
given bounding box, i.e. it will never squeeze the image.
It really is quite fast... It works by skipping over most of the
information in the JPEG data which will not be used anyway in the case
of a thumbnail:
It makes use of libjpeg features of being able to load an image by
only
deocding the DCT coefficients needed to reconstruct an image of the
size
desired. This gives a massive speedup.
You can download the wrapper class stuff at
http://www2.entropy.ch/download/Epeg.zip
The original library is at
http://www.rasterman.com/code.html
_________________________________________________________________
Marc Liyanage liyanage@access.ch
http://www.entropy.ch
iChat: liyanage@mac.com
Yoda I am. Grammar I can't.
_________________________________________________________________
_______________________________________________
cocoa-dev mailing list | cocoa-dev@lists.apple.com
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.