Abstract: We present a variant of the JPEG baseline image compression algorithm optimized for images that were generated by a JPEG decompressor. It inverts the computational steps of one particular JPEG decompressor implementation (Independent JPEG Group, IJG), and uses interval arithmetic and an iterative process to infer the possible values of intermediate results during the decompression, which are not directly evident from the decompressor output due to rounding. We applied our exact recompressor on a large database of images, each compressed at ten different quality factors. At the default IJG quality factor 75, our implementation reconstructed the exact quantized transform coefficients in 96\% of the 64-pixel image blocks. For blocks where exact reconstruction is not possible, our implementation can output transform-coefficient intervals, each guaranteed to contain the respective original value. Where different JPEG images decompress to the same result, we can output all possible bit-streams. At quality factors 90 and above, exact recompression becomes infeasible due to combinatorial explosion; but 68\% of blocks still recompressed exactly.

@conference{lewis:75430V,
  numpages     = {9},
  publisher    = {SPIE},
  doi          = {10.1117/12.838878},
  location     = {San Jose, California, USA},
  url          = {http://www.cl.cam.ac.uk/~abl26/spie10-full.pdf},
  collaboration= {},
  author       = {Andrew B. Lewis and Markus G. Kuhn},
  number       = {1},
  pages        = {75430V},
  volume       = {7543},
  editor       = {Amir Said and Onur G. Guleryuz},
  year         = {2010},
  title        = {Exact {JPEG} recompression},
  journal      = {Visual Information Processing and Communication},
  eid          = {75430V},
}