问题描述
我正在尝试从相机拍摄照片,下面的代码有效,但我注意到两个问题,第一是输出质量与相机预览相比较差,第二是位图旋转
public static Bitmap getSourceBitmap(byte[] data,int width,int height,boolean isFrontCamera) {
YuvImage yuvimage = new YuvImage(data,ImageFormat.NV21,width,height,null);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
yuvimage.compresstoJpeg(new Rect(0,height),100,baos);
byte[] jdata = baos.toByteArray();
BitmapFactory.Options bitmapFatoryOptions = new BitmapFactory.Options();
bitmapFatoryOptions.inPreferredConfig = Bitmap.Config.ARGB_8888;
Bitmap bmp = BitmapFactory.decodeByteArray(jdata,jdata.length,bitmapFatoryOptions);
return Bitmap.createBitmap(bmp,mWidth,mHeight,m,true);
}
谢谢
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)