improving JPEG writing in ImageWorker