Dropbox has open-sourced its very own compression code.
Available on GitHub the "Lepton" code “... achieves a 22% savings reduction for existing JPEG images, by predicting coefficients in JPEG blocks and feeding those predictions as context into an arithmetic coder."
Dropbox's announcement of the release explains the tech in considerable detail. ®