public static void saveBitmap(Bitmap bm) { Log.e(TAG, "保存图片"); File sdDir = Environment.getExternalStorageDirectory(); String tmpFile = sdDir.toString()+"/DCIM/" + "occlusionCap.jpg"; File f = new File(tmpFile); if (f.exists()) return; try { FileOutputStream out = new FileOutputStream(f); bm.compress(Bitmap.CompressFormat.PNG, 90, out); out.flush(); out.close(); Log.i(TAG, "已经保存"); } catch (FileNotFoundException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
将Android Bitmap转换成png格式的图像
最新推荐文章于 2024-08-12 04:07:39 发布