ImageProxy

interface ImageProxy : AutoCloseable
androidx.camera.core.ImageProxy

An image proxy which has a similar interface as android.media.Image.

Summary

Nested classes

abstract

A plane proxy which has an analogous interface as android.media.Image.Plane.

Public methods

abstract Unit

Closes the underlying android.media.Image.

abstract Rect

Returns the crop rectangle.

abstract Int

Returns the image format.

abstract Int

Returns the image height.

abstract Image?

Returns the android Image.

abstract ImageInfo

Returns the ImageInfo.

abstract Array<ImageProxy.PlaneProxy!>

Returns the array of planes.

abstract Int

Returns the image width.

abstract Unit
setCropRect(@Nullable rect: Rect?)

Sets the crop rectangle.

Public methods

close

abstract fun close(): Unit

Closes the underlying android.media.Image.

getCropRect

@NonNull abstract fun getCropRect(): Rect

Returns the crop rectangle.

getFormat

abstract fun getFormat(): Int

Returns the image format.

getHeight

abstract fun getHeight(): Int

Returns the image height.

getImage

@Nullable abstract fun getImage(): Image?

Returns the android Image.

If the ImageProxy is a wrapper for an android Image, it will return the Image. It is possible for an ImageProxy to wrap something that isn't an Image. If that's the case then it will return null.

The returned image should not be closed by the application. Instead it should be closed by the ImageProxy, which happens, for example, on return from the ImageAnalysis.Analyzer function. Destroying the ImageAnalysis will close the underlying android.media.ImageReader. So an Image obtained with this method will behave as such.

Return
Image?: the android image.

getImageInfo

@NonNull abstract fun getImageInfo(): ImageInfo

Returns the ImageInfo.

getPlanes

@NonNull abstract fun getPlanes(): Array<ImageProxy.PlaneProxy!>

Returns the array of planes.

getWidth

abstract fun getWidth(): Int

Returns the image width.

setCropRect

abstract fun setCropRect(@Nullable rect: Rect?): Unit

Sets the crop rectangle.