ImageMagick may work. There are various Java wrappers for ImageMagick, which is an image manipulation library of outstanding quality (and speed).
JMagick is one such wrapper, there are other ones:
http://www.jmagick.org/index.html
Then some people advice using ProcessBuilder to directly make "native" calls for apparently the perfs are better and there's less risk of crashes (the ImageMagick wrappers may not be that great from a performances and memory usage point of view).
If speed and JPEG quality are an issue, then you can't go much wrong with ImageMagick: it's up to you to see if you prefer to use a wrapper or directly calling the ImageMagick executables from your Java program.
Now of course this would only work if writing a lossless file from your app (say PNG files) is fast enough.