Android - 使用Android自定义相机拍摄的Bug图像

时间:2014-06-08 09:49:50

标签: android image android-camera image-manipulation

我建立了一个自己的相机应用程序,所有在我的Galaxy Nexus中工作正常。我已经在某些设备和Nexus 4中测试了该应用,拍摄的照片是不正常的。好像它成倍增加..

enter image description here

在我的PictureCallback中,我使用以下代码保存图片:

        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) {
        } 

位图位图是拍摄照片上的“自拍”图像。这个drawable正确显示,而不是照片。它只发生在nexus 4

0 个答案:

没有答案