Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: image manipulation as byte[]


I'm sorry that I'm not good at English.

I want to make a real-time image manipulation app.(Binarization, color inverse...etc.)

It needs speed, so I want to manipulate it as byte[], without converting to Image or Bitmap.

The format of image that I got from camera was YUV(NV21), but because I don't know about this format, I convert it to JPEG.

but it also doesn't work as I expected.(I thought it would be one Byte per one pixel or three byte per one pixel.)


  1. How can I do such manipulation(binarization, color inverse) as JPEG byte array?
  2. or How can I convert NV21 format byte array to RGB byte array?

and I used the method to convert NV21 to JPEG.

YuvImage yuvimage = new YuvImage(bytes, ImageFormat.NV21, width, height, null);
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
yuvimage.compressToJpeg(new Rect(0, 0, width, height), 100, outputStream);

and I got yuv image byte array from onPreviewFrame(Camra.PreviewCallback).

Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered

This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: image manipulation as byte[]


Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription