iwp.setCompressionQuality(_quality);
ImageOutputStream ios = ImageIO.createImageOutputStream(os);
iw.setOutput(ios);
iw.write(null, new IIOImage(image, null, null), iwp);
ios.flush();
iw.dispose();
ios.close();
return os.toByteArray();
}
/** Returns the quality of the image encoding.
* It is a number between 0 and 1. The higher the value,