ImageReader


public class ImageReader
extends Object implements AutoCloseable

java.lang.Object
   ↳ android.media.ImageReader


The ImageReader class allows direct application access to image data rendered into a Surface

Several Android media API classes accept Surface objects as targets to render to, including MediaPlayer, MediaCodec, CameraDevice, ImageWriter and RenderScript Allocations. The image sizes and formats that can be used with each source vary, and should be checked in the documentation for the specific API.

The image data is encapsulated in Image objects, and multiple such objects can be accessed at the same time, up to the number specified by the maxImages constructor parameter. New images sent to an ImageReader through its Surface are queued until accessed through the acquireLatestImage() or acquireNextImage() call. Due to memory limits, an image source will eventually stall or drop Images in trying to render to the Surface if the ImageReader does not obtain and release Images at a rate equal to the production rate.

Summary

Nested classes

class ImageReader.Builder

Builder class for ImageReader objects. 

interface ImageReader.OnImageAvailableListener

Callback interface for being notified that a new image is available. 

Public methods

Image acquireLatestImage()

Acquire the latest Image from the ImageReader's queue, dropping older images.

Image acquireNextImage()

Acquire the next Image from the ImageReader's queue.

void close()

Free up all the resources associated with this ImageReader.