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

 
libjpeg.txt · Last modified: 2010/06/06 11:10 by twk
 
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki