Libjpeg cookbook