当前位置: 动力学知识库 > 问答 > 编程问答 >

Android - Bug image taken using Android Custom Camera

问题描述:

I built an own Camera App and all works fine in my Galaxy Nexus. I've tested the app in some devices and in the Nexus 4 the picture taken is abnormal. As if it were multiplied..

In my PictureCallback I save the picture with this code:

 File pictureFile = getOutputMediaFile(MEDIA_TYPE_IMAGE);

if (pictureFile == null){

return;

}

try {

FileOutputStream fos = new FileOutputStream(pictureFile);

Bitmap realImage = BitmapFactory.decodeByteArray(data, 0, data.length);

Canvas cs = new Canvas(realImage);

Paint tPaint = new Paint();

Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.id_photo);

cs.drawBitmap(bitmap , cs.getWidth()-bitmap.getWidth() , cs.getHeight()-bitmap.getHeight() , tPaint);

realImage.compress(Bitmap.CompressFormat.JPEG, 95, fos);

fos.write(data);

fos.close();

} catch (FileNotFoundException e) {

} catch (IOException e) {

}

The Bitmap bitmap is the "Selfie" image, over the picture taken. This drawable is shown correctly, not the photo. It happens only on the nexus 4

分享给朋友:
您可能感兴趣的文章:
随机阅读: