//3.保存Bitmap
try {
File path = new File(SavePath);
//文件
final String filepath = SavePath + System.currentTimeMillis() + ".png";
final File file = new File(filepath);
if (!path.exists()) {
path.mkdirs();
}
if (!file.exists()) {
file.createNewFile();
}
FileOutputStream fos = null;
fos = new FileOutputStream(file);
if (null != fos) {
bmp.compress(Bitmap.CompressFormat.PNG, 0, fos);
fos.flush();
fos.close();
bmp.compress(Bitmap.CompressFormat.PNG, 0, fos);可以设置对原图片进行比例压缩然后保存到本地。在此方法中,已将图片流写入fos。接下来只需刷新一下输出流就可以了。
1230





