写出图像为指定格式

@param image {@link Image}
@param imageType 图片类型（图片扩展名）
@param destImageStream 写出到的目标流
@param quality 质量，数字为0~1（不包括0和1）表示质量压缩比，除此数字外设置表示不压缩
@return 是否成功写出，如果返回false表示未找到合适的Writer
@throws IORuntimeException IO异常
@since 4.3.2
10675
public static boolean write(Image image, String imageType, ImageOutputStream destImageStream, float quality) throws IORuntimeException {
		if (StrUtil.isBlank(imageType)) {
			imageType = IMAGE_TYPE_JPG;
		}

		final ImageWriter writer = getWriter(image, imageType);
		return write(toBufferedImage(image, imageType), writer, destImageStream, quality);
	}
202698
public boolean write(ImageOutputStream targetImageStream) throws IORuntimeException {
		Assert.notBlank(this.targetImageType, "Target image type is blank !");
		Assert.notNull(targetImageStream, "Target output stream is null !");

		final BufferedImage targetImage = (null == this.targetImage) ? this.srcImage : this.targetImage;
		Assert.notNull(targetImage, "Target image is null !");
		
		return ImgUtil.write(targetImage, this.targetImageType, targetImageStream, this.quality);
	}
1294380
public static void binary(Image srcImage, ImageOutputStream destImageStream, String imageType) throws IORuntimeException {
		write(binary(srcImage), imageType, destImageStream);
	}
278977
public static void binary(Image srcImage, OutputStream out, String imageType) {
		binary(srcImage, getImageOutputStream(out), imageType);
	}
804839
public CustomEmojiBuilder setImage(InputStream image, String type) {
        delegate.setImage(image, type);
        return this;
    }
1101316
public static String toBase64(Image image, String imageType) {
		final ByteArrayOutputStream out = new ByteArrayOutputStream();
		write(image, imageType, out);
		return Base64.encode(out.toByteArray());
	}
1096897
public static void generate(String content, int width, int height, String imageType, OutputStream out) {
		final BufferedImage image = generate(content, width, height);
		ImgUtil.write(image, imageType, out);
	}
1028989
public static BufferedImage toBufferedImage(final Image image) {
        if (image instanceof BufferedImage) {
            return (BufferedImage) image;
        }

        // Create a buffered image with transparency
        final BufferedImage bufferedImage =
                new BufferedImage(image.getWidth(null), image.getHeight(null), BufferedImage.TYPE_INT_ARGB);

        final Graphics2D bufferedGraphics = bufferedImage.createGraphics();
        bufferedGraphics.drawImage(image, 0, 0, null);
        bufferedGraphics.dispose();

        // Return the buffered image
        return bufferedImage;
    }
1027541
private BufferedImage convertImage(BufferedImage image)
    {
        if (image.getType() == BufferedImage.TYPE_INT_RGB)
        {
            return image;
        }
        else
        {
            BufferedImage newImage = new BufferedImage(image.getWidth(),
                                                       image.getHeight(),
                                                       BufferedImage.TYPE_INT_RGB);
            newImage.getGraphics().drawImage(image, 0, 0, null);
            return newImage;
        }
    }
879975
public void setImage(T image) {
		blur.reshape(image.width,image.height);
		filterBlur.process(image,blur);
		describe.setImage(image);
	}
634956
public static void gray(Image srcImage, ImageOutputStream destImageStream) throws IORuntimeException {
		writeJpg(gray(srcImage), destImageStream);
	}
624615
public static void cut(Image srcImage, ImageOutputStream destImageStream, Rectangle rectangle) throws IORuntimeException {
		writeJpg(cut(srcImage, rectangle), destImageStream);
	}
1267597
public ImageHandlerBuilder reduceQuality(float qualityPercent) {
         ImageWriter imageWriter = ImageIO.getImageWritersByFormatName(fn.extension()).next();
         if (imageWriter != null) {
             ImageWriteParam writeParam = imageWriter.getDefaultWriteParam();
             writeParam.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
             writeParam.setCompressionQuality(qualityPercent);

             ByteArrayOutputStream baos = new ByteArrayOutputStream();
             imageWriter.setOutput(new MemoryCacheImageOutputStream(baos));
             try {
                 imageWriter.write(null, new IIOImage(image, null, null), writeParam);
                 imageWriter.dispose();
             } catch (IOException e) {
                 throw new ControllerException(e);
             }
             
             try {
                BufferedImage lowImage = ImageIO.read(new ByteArrayInputStream(baos.toByteArray()));
                image.flush();
                image = lowImage;
            } catch (IOException e) {
                throw new ControllerException(e);
            }
         }
         return this;
     }
268243
@Deprecated
	public static void convert(Image srcImage, String formatName, ImageOutputStream destImageStream) {
		convert(srcImage, formatName, destImageStream, false);
	}
402393
public static void cut(Image srcImage, File destFile, Rectangle rectangle) throws IORuntimeException {
		write(cut(srcImage, rectangle), destFile);
	}
1196543
public static ImageInputStream getImageInputStream(InputStream in) throws IORuntimeException {
		try {
			return ImageIO.createImageInputStream(in);
		} catch (IOException e) {
			throw new IORuntimeException(e);
		}
	}
645462
public static BufferedImage getImage(byte[] imageBytes) throws IOException {

		BufferedImage image = null;

		if (imageBytes != null) {
			ByteArrayInputStream stream = new ByteArrayInputStream(imageBytes);
			image = ImageIO.read(stream);
			stream.close();
		}

		return image;
	}