code: public static boolean write(Image image, ImageWriter writer, ImageOutputStream output, float quality) {
  		if (writer == null) {
  			return false;
  		}
  
  		writer.setOutput(output);
  		final RenderedImage renderedImage = toRenderedImage(image);
  		// 设置质量
  		ImageWriteParam imgWriteParams = null;
  		if (quality > 0 && quality < 1) {
  			imgWriteParams = writer.getDefaultWriteParam();
  			if (imgWriteParams.canWriteCompressed()) {
  				imgWriteParams.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
  				imgWriteParams.setCompressionQuality(quality);
  				final ColorModel colorModel = renderedImage.getColorModel();// ColorModel.getRGBdefault();
  				imgWriteParams.setDestinationType(new ImageTypeSpecifier(colorModel, colorModel.createCompatibleSampleModel(16, 16)));
  			}
  		}
  
  		try {
  			if (null != imgWriteParams) {
  				writer.write(null, new IIOImage(renderedImage, null, null), imgWriteParams);
  			} else {
  				writer.write(renderedImage);
  			}
  			output.flush();
  		} catch (IOException e) {
  			throw new IORuntimeException(e);
  		} finally {
  			writer.dispose();
  		}
  		return true;
  	}
docs: 通过{@link ImageWriter}写出图片到输出流
  
  @param image 图片
  @param writer {@link ImageWriter}
  @param output 输出的Image流{@link ImageOutputStream}
  @param quality 质量，数字为0~1（不包括0和1）表示质量压缩比，除此数字外设置表示不压缩
  @return 是否成功写出
  @since 4.3.2