Camera picture to Bitmap results in messed up image

后端 未结 7 1995
谎友^
谎友^ 2020-12-29 10:00

This is my code that I use to save the image to a Bitmap. This piece of code is based on the code from CyanogenMod\'s camera app so I would assume it would work

7条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-29 10:05

    Try this

    Bitmap bmp = BitmapFactory.decodeByteArray(data, 0, data.length);
    imv.setImageBitmap(bmp);
    
    ByteArrayOutputStream bos = new ByteArrayOutputStream();
    bmp.compress(CompressFormat.JPEG, 70, bos);
    

提交回复
热议问题