public static void savePNG_After(Bitmap bitmap, String name) {
File file = new File(name);
try {
FileOutputStream out = new FileOutputStream(file);
if (bitmap.compress(Bitmap.CompressFormat.PNG, 100, out)) {
out.flush();
out.close();
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
}
//转jpg就把Bitmap.CompressFormat.PNG改成Bitmap.Compressformat.JPEG
 
 
 转自:https://www.cnblogs.com/mrzzzblog/p/15810001.html