将bitmap转为File文件

public void saveBitmapFile(Bitmap bitmap) {

    File file = new File("storage/emulated/legacy/s.jpg");//将要保存图片的路径
    try {
        BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(file));

        bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bos);
        uploadPic(file);

        bos.flush();
        bos.close();

    } catch (IOException e) {
        e.printStackTrace();
    }

}

你可能感兴趣的:(将bitmap转为File文件)