转换位图到文件 [英] Convert Bitmap to File

查看:206
本文介绍了转换位图到文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

据我所知,使用 BitmapFactory 可以将文件转换为位图,但有什么办法一个位图图像转换成一个文件?

I understand that using BitmapFactory can convert a File to a Bitmap, but is there any way to convert a Bitmap image to a File?

推荐答案

试试这个:

    bitmap.compress(Bitmap.CompressFormat.PNG, quality, outStream);

检查<一href="http://developer.android.com/reference/android/graphics/Bitmap.html#com$p$pss(android.graphics.Bitmap.Com$p$pssFormat,%20int,%20java.io.OutputStream%29">http://developer.android.com/reference/android/graphics/Bitmap.html#com$p$pss(android.graphics.Bitmap.Com$p$pssFormat,%20int,%20java.io.OutputStream%29

这篇关于转换位图到文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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