# ImageProxyTransformFactory

Artifact: [androidx.camera:camera-view](https://developer.android.com/jetpack/androidx/releases/camera) [View Source](https://cs.android.com/search?q=file:androidx/camera/view/transform/ImageProxyTransformFactory.java+class:androidx.camera.view.transform.ImageProxyTransformFactory) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0)

*** ** * ** ***


```
public final class ImageProxyTransformFactory
```

<br />

*** ** * ** ***

Factory for extracting transform info from `https://developer.android.com/reference/androidx/camera/core/ImageProxy`.

This class is for extracting a `https://developer.android.com/reference/androidx/camera/view/transform/OutputTransform` from an `https://developer.android.com/reference/androidx/camera/core/ImageProxy` object. The `https://developer.android.com/reference/androidx/camera/view/transform/OutputTransform` represents the transform being applied to the original camera buffer, which can be used by `https://developer.android.com/reference/androidx/camera/view/transform/CoordinateTransform` to transform coordinates between `https://developer.android.com/reference/androidx/camera/core/UseCase`s.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/view/transform/OutputTransform` |   |
| `https://developer.android.com/reference/androidx/camera/view/transform/CoordinateTransform` |   |

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/camera/view/transform/ImageProxyTransformFactory#ImageProxyTransformFactory()()` |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/view/transform/OutputTransform` | `https://developer.android.com/reference/androidx/camera/view/transform/ImageProxyTransformFactory#getOutputTransform(androidx.camera.core.ImageProxy)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/ImageProxy imageProxy)` Extracts the transform from the given `https://developer.android.com/reference/androidx/camera/core/ImageProxy`. |
| `boolean` | `https://developer.android.com/reference/androidx/camera/view/transform/ImageProxyTransformFactory#isUsingCropRect()()` Whether the factory respects the value of `https://developer.android.com/reference/androidx/camera/core/ImageProxy#getCropRect()`. |
| `boolean` | `https://developer.android.com/reference/androidx/camera/view/transform/ImageProxyTransformFactory#isUsingRotationDegrees()()` Whether the factory respects the value of `https://developer.android.com/reference/androidx/camera/core/ImageInfo#getRotationDegrees()`. |
| `void` | `https://developer.android.com/reference/androidx/camera/view/transform/ImageProxyTransformFactory#setUsingCropRect(boolean)(boolean usingCropRect)` Whether to use the crop rect of the `https://developer.android.com/reference/androidx/camera/core/ImageProxy`. |
| `void` | `https://developer.android.com/reference/androidx/camera/view/transform/ImageProxyTransformFactory#setUsingRotationDegrees(boolean)(boolean usingRotationDegrees)` Whether to use the rotation degrees of the `https://developer.android.com/reference/androidx/camera/core/ImageProxy`. |

## Public constructors

### ImageProxyTransformFactory

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

```
public ImageProxyTransformFactory()
```

## Public methods

### getOutputTransform

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

```
public @NonNull OutputTransform getOutputTransform(@NonNull ImageProxy imageProxy)
```

Extracts the transform from the given `https://developer.android.com/reference/androidx/camera/core/ImageProxy`.

This method returns a `https://developer.android.com/reference/androidx/camera/view/transform/OutputTransform` that represents the transform applied to the buffer of a `https://developer.android.com/reference/androidx/camera/core/ImageProxy` based on factory settings. An `https://developer.android.com/reference/androidx/camera/core/ImageProxy` can be the output of `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis` or in-memory `https://developer.android.com/reference/androidx/camera/core/ImageCapture`.

### isUsingCropRect

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

```
public boolean isUsingCropRect()
```

Whether the factory respects the value of `https://developer.android.com/reference/androidx/camera/core/ImageProxy#getCropRect()`.

By default, the value is false.

### isUsingRotationDegrees

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

```
public boolean isUsingRotationDegrees()
```

Whether the factory respects the value of `https://developer.android.com/reference/androidx/camera/core/ImageInfo#getRotationDegrees()`.

By default, the value is false.

### setUsingCropRect

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

```
public void setUsingCropRect(boolean usingCropRect)
```

Whether to use the crop rect of the `https://developer.android.com/reference/androidx/camera/core/ImageProxy`.

By default, the value is false and the factory uses the `https://developer.android.com/reference/androidx/camera/core/ImageProxy`'s entire buffer. Only set this value if the coordinates to be transformed respect the crop rect. For example, top-left corner of the crop rect is (0, 0).

### setUsingRotationDegrees

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

```
public void setUsingRotationDegrees(boolean usingRotationDegrees)
```

Whether to use the rotation degrees of the `https://developer.android.com/reference/androidx/camera/core/ImageProxy`.

By default, the value is false and the factory uses a rotation degree of 0. Only set this value to true if the coordinates to be transformed is after the rotation degree is applied. For example, if the `https://developer.android.com/reference/androidx/camera/core/ImageInfo#getRotationDegrees()` is 90 degrees, (0, 0) in the original buffer should be mapped to (height, 0) in the rotated image. Set this value to true if the input coordinates are based on the original image, and false if the coordinates are based on the rotated image.