Monday, July 30, 2012

[android-developers] Byte [] image

I'm working on an app, in which i convert the byte[] image to bitmap, but it showed me some weird image, (in attachment), here is my code

PictureCallback PictureCallback myPictureCallback_JPG = new () {

@ Override
public void onPictureTaken (byte [] arg0, arg1 Camera) {
/ / TODO Auto-generated method stub
Camera.Parameters arg1.getParameters parameters = ();

            int width = parameters.getPreviewSize (). width;
            int height = parameters.getPreviewSize (). height;

            ByteArrayOutputStream outStr = new ByteArrayOutputStream ();
            Rect rect = new Rect (0, 0, width, height); 
            YuvImage yuvimage = new YuvImage (arg0, ImageFormat.NV21, width, height, null);
            yuvimage.compressToJpeg (rect, 100, outStr);
            Bitmap bmp = BitmapFactory.decodeByteArray (outstr.toByteArray (), 0, outstr.size ());
Any help? Thanks in advance.

You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

No comments:

Post a Comment