Iterator<ImageWriter> iterator = ImageIO.getImageWritersByFormatName("jpeg");
ImageWriter imageWriter = iterator.next();
ImageWriteParam imageWriteParam = imageWriter.getDefaultWriteParam();
imageWriteParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
imageWriteParam.setCompressionQuality(1); imageWriter.setOutput(imageOutput);
IIOImage iio_image = new IIOImage(image, null, null);
imageWriter.write(null, iio_image, imageWriteParam);
imageWriter.dispose();