/**
* @param b Bitmap
* @return 图片存储的位置
*/
public static File saveImg(Bitmap b, String name) throws Exception {
String path = Environment.getExternalStorageDirectory().getPath() + File.separator + "test/headImg/";
File mediaFile = new File(path + File.separator + name + ".jpg");
if (mediaFile.exists()) {
mediaFile.delete();
}
if (!new File(path).exists()) {
new File(path).mkdirs();
}
mediaFile.createNewFile();
FileOutputStream fos = new FileOutputStream(mediaFile);
b.compress(Bitmap.CompressFormat.PNG, 100, fos);
fos.flush();
fos.close();
b.recycle();
b = null;
System.gc();
// return mediaFile.getPath();
return mediaFile;
}
ImageCompressUtil.java 文件源码
java
阅读 35
收藏 0
点赞 0
评论 0
项目:pc-android-controller-android
作者:
评论列表
文章目录