Converting preview frame to bitmap

后端 未结 5 1735
天涯浪人
天涯浪人 2020-11-29 07:30

I know the subject was on the board many times, but i can not get it work anyhow... I want to save view frames from preview to jpeg files. It looks more or less(code is simp

5条回答
  •  被撕碎了的回忆
    2020-11-29 08:20

    In order to avoid degraded JPEG image on the output (e.g. with interleaving green/red spots), you need to flush and close FileOutputStream

    FileOutputStream filecon = new FileOutputStream(file); 
    image.compressToJpeg( 
                new Rect(0, 0, image.getWidth(), image.getHeight()), 90, 
            filecon);
    filecon.flush();
    filecon.close();
    

提交回复
热议问题