Don't use quality=keep when original image is not a JPEG or when quantization table is invalid