> Documentation index: https://developer.android.com/reference/llms.txt

# MutableImageWrapper

Artifact: [androidx.camera:camera-common](https://developer.android.com/jetpack/androidx/releases/camera.md.txt) [View Source](https://cs.android.com/search?q=file:androidx/camera/common/ImageWrapper.kt+class:androidx.camera.common.MutableImageWrapper) Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/camera.md.txt#1.7.0)

*** ** * ** ***


```
public interface MutableImageWrapper extends ImageWrapper
```

<br />

Known direct subclasses [FakeImage](https://developer.android.com/reference/androidx/camera/common/testing/FakeImage.md.txt)

|---|---|
| `FakeImage` | Fake implementation of `MutableImageWrapper` for testing. |

*** ** * ** ***

A mutable extension of `ImageWrapper` that allows modifying properties of the image.

This interface is useful when modifying the metadata of an image, such as its crop rectangle, timestamp, or synchronization fence.

## Summary

| ### Public methods |
|---|---|
| `abstract @NonNull Rect` | `getCropRect()` The crop rectangle of the image. |
| `abstract int` | `getDataSpace()` The dataspace associated with this image. |
| `abstract SyncFence` | `getSyncFence()` The sync fence associated with this image, or `null` if there is no fence. |
| `abstract long` | `getTimestamp()` The timestamp associated with this image, in nanoseconds. |
| `abstract void` | `setCropRect(@NonNull Rect value)` The crop rectangle of the image. |
| `abstract void` | `setDataSpace(int value)` The dataspace associated with this image. |
| `abstract void` | `setSyncFence(SyncFence value)` The sync fence associated with this image, or `null` if there is no fence. |
| `abstract void` | `setTimestamp(long value)` The timestamp associated with this image, in nanoseconds. |

### Inherited methods

From [androidx.camera.common.ImageWrapper](https://developer.android.com/reference/androidx/camera/common/ImageWrapper.md.txt) `abstract void` `close()`

Closes the underlying image and releases any associated resources.
`abstract int` `getFormat()`

The format of the image.
`default HardwareBuffer` `getHardwareBuffer()`

The handle to the underlying image's hardware buffer, or `null` if this image does not support hardware buffers.
`abstract int` `getHeight()`

The height of the image in pixels.
`abstract @NonNull List<@NonNull ImagePlane>` `getImagePlanes()`

The list of pixel planes for this image.
`abstract int` `getWidth()`

The width of the image in pixels.
From [androidx.camera.common.UnsafeWrapper](https://developer.android.com/reference/androidx/camera/common/UnsafeWrapper.md.txt) `abstract T` `<T extends Object> unwrapAs(@NonNull Class<@NonNull T> type)`

Attempts to unwrap this object into the specified underlying `type`.

## Public methods

### getCropRect

```
abstract @NonNull Rect getCropRect()
```

The crop rectangle of the image.

| See also |
|---|---|
| `setCropRect` |   |

### getDataSpace

```
abstract int getDataSpace()
```

The dataspace associated with this image.

The value set must be one of the constants defined in `ImageDataSpace`.

Value is one of the following:

- `4096`
- `4098`
- `4100`
- `4101`
- `0`
- `406913024`
- `142671872`
- `411107328`
- `143261696`
- `168165376`
- `163971072`
- `151715840`
- `146931712`
- `281149440`
- `281280512`
- `147193856`
- `281083904`
- `155844608`
- `138477568`

<br />

| See also |
|---|---|
| `setDataSpace` |   |
| `ImageDataSpace` |   |

### getSyncFence

```
abstract SyncFence getSyncFence()
```

The sync fence associated with this image, or `null` if there is no fence.

| See also |
|---|---|
| `setFence` |   |

### getTimestamp

```
abstract long getTimestamp()
```

The timestamp associated with this image, in nanoseconds.

| See also |
|---|---|
| `setTimestamp` |   |

### setCropRect

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/camera.md.txt#1.7.0)

```
abstract void setCropRect(@NonNull Rect value)
```

The crop rectangle of the image.

| See also |
|---|---|
| `setCropRect` |   |

### setDataSpace

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/camera.md.txt#1.7.0)

```
abstract void setDataSpace(int value)
```

The dataspace associated with this image.

The value set must be one of the constants defined in `ImageDataSpace`.

| See also |
|---|---|
| `setDataSpace` |   |
| `ImageDataSpace` |   |

### setSyncFence

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/camera.md.txt#1.7.0)

```
abstract void setSyncFence(SyncFence value)
```

The sync fence associated with this image, or `null` if there is no fence.

| See also |
|---|---|
| `setFence` |   |

### setTimestamp

Added in [1.7.0](https://developer.android.com/jetpack/androidx/releases/camera.md.txt#1.7.0)

```
abstract void setTimestamp(long value)
```

The timestamp associated with this image, in nanoseconds.

| See also |
|---|---|
| `setTimestamp` |   |