Java android.graphics ImageFormat fields, constructors, methods, implement or subclass

Example usage for Java android.graphics ImageFormat fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.graphics ImageFormat.

The text is from its open source code.

Field

intUNKNOWN
intRGB_565
RGB format used for pictures encoded as RGB_565.
intYV12

Android YUV format.

This format is exposed to software decoders and applications.

YV12 is a 4:2:0 YCrCb planar format comprised of a WxH Y plane followed by (W/2) x (H/2) Cr and Cb planes.

This format assumes

  • an even width
  • an even height
  • a horizontal stride multiple of 16 pixels
  • a vertical stride equal to the height

 y_size = stride * height c_stride = ALIGN(stride/2, 16) c_size = c_stride * height/2 size = y_size + c_size * 2 cr_offset = y_size cb_offset = y_size + c_size

For the android.hardware.camera2 API, the #YUV_420_888 format is recommended for YUV output instead.

For the older camera API, this format is guaranteed to be supported for android.hardware.Camera preview images since API level 12; for earlier API versions, check android.hardware.Camera.Parameters#getSupportedPreviewFormats() .

intNV16
YCbCr format, used for video.
intNV21
YCrCb format used for images, which uses the NV21 encoding format.
intYUY2
YCbCr format used for images, which uses YUYV (YUY2) encoding format.
intJPEG
Compressed JPEG format.
intYUV_420_888

Multi-plane Android YUV 420 format

This format is a generic YCbCr format, capable of describing any 4:2:0 chroma-subsampled planar or semiplanar buffer (but not fully interleaved), with 8 bits per color sample.

Images in this format are always represented by three separate buffers of data, one for each color plane.

intRAW_SENSOR

General raw camera sensor image format, usually representing a single-channel Bayer-mosaic image.

intRAW10

Android 10-bit raw format

This is a single-plane, 10-bit per pixel, densely packed (in each row), unprocessed format, usually representing raw Bayer-pattern images coming from an image sensor.

intRAW12

Android 12-bit raw format

This is a single-plane, 12-bit per pixel, densely packed (in each row), unprocessed format, usually representing raw Bayer-pattern images coming from an image sensor.

Method

intgetBitsPerPixel(int format)
Use this function to retrieve the number of bits per pixel of an ImageFormat.