Revert "Revert "Optimised JPEG images""

This reverts commit 58d1bac9c5fe658674c6bfb4c09b18b123a02211.