BufferedImage在输出图片之前获取即将输出的图片的字节数

对于这些零零碎碎的需求就是,不废话,上代码!

BufferedImage image = ...;
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ImageIO.write(image, "png", baos);
byte[] imageBytes = baos.toByteArray();
int length = imageBytes.length;


版权声明:本文为weixin_44510171原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。