Table of Contents
Overview
Case Studies
Gotchas
Tips & Tricks
Alternatives
Other Resources
Overview
Project web site
, libjpeg is a C library for compressing and decompressing
JPEG
images.
Case Studies
On a Core 2 Duo E6300 it takes 1.5ms to compress a 160×120 RGB image, 0.6ms for 72×88, 0.06ms for 32×24.
Gotchas
Has a rather weird OO-style system implemented in C for customizing the behaviour.
The default compressor and decompressor work only for file descriptors, to do in-memory you need to write 5-6 functions of your own.
Tips & Tricks
Read the documentation and the example code that comes with libjpeg, you're going to need it.
When compressing, you can pass in an array of pointers to the same string as the scanlines array, so there's no need to copy data.
If you use setjmp/longjmp in your error handler, you can add the jump target to cinfo→client_data.
Alternatives
stb_image.c
- a small self-contained C lib for decompressing
JPEG
and
PNG
images
Other Resources
W3C's JPEG page