android 把bitmap格式转成jpg 或png格式

xiaoxiao2021-02-28  1

public static void savePNG_After(Bitmap bitmap, String name) { File file = new File(name); try { FileOutputStream 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(); } } //转jpg就把Bitmap.CompressFormat.PNG改成Bitmap.Compressformat.JPEG
转载请注明原文地址: https://www.6miu.com/read-1750263.html

最新回复(0)