Util

Util Bitmap轉File

PATH = 檔案位址
50 = 品質數0~100

private File saveImage(Bitmap bmp) {
        File file = new File(PATH);
        try {
            FileOutputStream fos = new FileOutputStream(file);
            bmp.compress(Bitmap.CompressFormat.JPEG, 50, fos);
            fos.flush();
            fos.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

        return file;
    }

發表迴響