输入:Bitmap对象、保存的路径、保存的文件名
注意路径的最后要带上 '/' 符号
private void saveBitmap(Bitmap bitmap,String path, String filename) throws IOException { File file = new File(path + filename); if(file.exists()){ file.delete(); } FileOutputStream out; try{ 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(); } }