0

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..

enter image description here

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

  • Upload an image to tinypic or dropcanvas and share the link of that abnormal case. – Sufian Jun 08 '14 at 09:51
  • That "selfie" at the bottom left makes it look like it's not a stretched image. Can you share your code (XML/Java)? – Sufian Jun 08 '14 at 12:38
  • Just a general recommendation, usually it's a good practise to print the exception like `e.printStackTrace()`. – Sufian Jun 08 '14 at 18:37
  • Duplicate of http://stackoverflow.com/questions/15404547/camera-picture-to-bitmap-results-in-messed-up-image *There is no accepted answer, but the results show that a) it is a Nexus 4 - specific bug; b) the bug is with bitmap, while the jpeg is OK; c) use 1280x720, the second-best resolution, and all is good.* – Alex Cohn Jun 08 '14 at 19:20

0 Answers0