如何将Android屏幕截图另存为.jpg? [英] How to make Android screenshots saved as .jpg?

查看:240
本文介绍了如何将Android屏幕截图另存为.jpg?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用ExifInterface保存用于图像描述的信息.但是因为屏幕截图保存为.png,而ExifInterface不适用于.png,所以我无法保存屏幕截图的图像描述.

I am using ExifInterface to save information for image description. But because screenshots are save .png and ExifInterface doesn't work on .png, I cannot save image description for screenshots.

我有两个选择:

  1. 每次我需要保存EXIF图像描述时,都需要先将屏幕截图转换为.jpg格式,然后编辑其EXIF数据.
  2. 或者我可以将手机设置为将所有屏幕截图另存为.jpg文件.因此,每当我保存屏幕截图时(通过按下降低音量键和电源按钮),屏幕截图都会保存在此处,然后保存为.jpg.稍后尝试转换它没有麻烦.

推荐答案

您可以利用View的图形缓存.

You can take advantage of a View's drawing cache.

myView.setDrawingCacheEnabled(true);
Bitmap b = view.getDrawingCache();
b.compress(CompressFormat.JPEG, 95, new FileOutputStream("/some/location/image.jpg"))

其中view是您的视图. 95是JPG压缩的质量.文件输出流就是这样.

Where view is your View. The 95 is the quality of the JPG compression. And the file output stream is just that.

这篇关于如何将Android屏幕截图另存为.jpg?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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