How to change the image format from JPEG to PNG in android?

前端 未结 1 718
野性不改
野性不改 2020-12-29 16:16

I am opening the default android device camera by passing an intent. So when an image is captured, by default, camera stores it in JPEG format. But I don\'t want to store th

相关标签:
1条回答
  • 2020-12-29 16:57

    I haven't come across any method to make the camera save the file as PNG.

    But you could convert the JPEG Image into PNG format.

    try {
           FileOutputStream out = new FileOutputStream(filename);
           bmp.compress(Bitmap.CompressFormat.PNG, 100, out); //100-best quality
           out.close();
    } catch (Exception e) {
           e.printStackTrace();
    }
    

    Note, this won't enhance the quality. You cannot "increase" the information in an image. This will only change the Image Format.

    0 讨论(0)
提交回复
热议问题