ImageProxy

public interface ImageProxy
implements AutoCloseable

androidx.camera.core.ImageProxy


An image proxy which has a similar interface as Image.

Summary

Nested classes

interface ImageProxy.PlaneProxy

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

Public methods

abstract void close()

Closes the underlying Image.

abstract Rect getCropRect()

Returns the crop rectangle.

abstract int getFormat()

Returns the image format.

abstract int getHeight()

Returns the image height.

abstract Image getImage()

Returns the android Image.

abstract ImageInfo getImageInfo()

Returns the ImageInfo.

abstract PlaneProxy[] getPlanes()

Returns the array of planes.

abstract int getWidth()

Returns the image width.

abstract void setCropRect(Rect rect)

Sets the crop rectangle.

Inherited methods

Public methods

close

public abstract void close ()

Closes the underlying Image.

See also:

getCropRect

public abstract Rect getCropRect ()

Returns the crop rectangle.

Returns
Rect

getFormat

public abstract int getFormat ()

Returns the image format.

Returns
int

See also:

getHeight

public abstract int getHeight ()

Returns the image height.

Returns
int

See also:

getImage

public abstract Image getImage ()

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 ImageReader. So an Image obtained with this method will behave as such.

Returns
Image the android image.

See also:

getImageInfo

public abstract ImageInfo getImageInfo ()

Returns the ImageInfo.

Returns
ImageInfo

getPlanes

public abstract PlaneProxy[] getPlanes ()

Returns the array of planes.

Returns
PlaneProxy[]

See also:

getWidth

public abstract int getWidth ()

Returns the image width.

Returns
int

See also:

setCropRect

public abstract void setCropRect (Rect rect)

Sets the crop rectangle.

Parameters
rect Rect