Introduction to lossless JPEGThe JPEG format is based on the Discrete Cosine Transform (DCT) performed on equally sized blocks of the pixel image data. With this in mind one can conclude that it is possible to perform some transformations on the image data directly on these DCT coefficients by just moving and transforming the coefficients.
As just working on the DCT coefficients is less expensive (in terms of CPU cycles) as the decoding and re-encoding process is skipped, it saving a lot time and additionally prevents new compression artefacts.
Lossless JPEG transformations where first implemented in the Open Source jpegtran program - a companion application of the JPEG library, but as using a different tool or library for every image format is a bit unhandy. Support for these transformations based on the jpegtran code was added to ExactImage version 0.3.0.
ExactImage 0.3.0 supports lossless:
ExactImage 0.3.1 further introduced:
ExactImage 0.4.1 further introduced:
Common with all this operations is that they are way faster than performing the pixel-level algorithm on the decoded image data and (aside down-scaling) do not introduce new artefacts.
Fast down-scaling is also implemented by Enlightenment's EPEG library explicitly and we should mention that EPEG is slightly faster, but with cost to image quality - mostly because it does just nearest neighbor scaling of the residual scaling applied on top of the partial DCT decoding:
(A trick how to get a few percent faster down-scaling is outlined in the econvert Tips & Tricks section.)
ExactImage fast JPEG scaling and EPEG compared:
|
|||||||||||||||||||