在以Java格式保存到磁盘之前压缩映像 [英] Compress Image before Saving to disk in Java

查看:142
本文介绍了在以Java格式保存到磁盘之前压缩映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在保存图像之前压缩图像?
我使用Robot类捕获图像,并返回一个BufferedImage。
如何压缩此图片,然后保存?

Is it possible to compress an image before saving it? I'm using the Robot class to capture images, and it returns a BufferedImage. How can I compress this image and then save it?

推荐答案

.png 文件是(无损)压缩图像。

.png files are (losslessly) compressed images.

您可以使用 ImageIO.write() / a>以保存.png图片

ImageIO.write(myBufferedImage, "png", outputfile);

这篇关于在以Java格式保存到磁盘之前压缩映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆