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 android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment