# ResolutionInfo

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

*** ** * ** ***


```
public class ResolutionInfo
```

<br />

*** ** * ** ***

A `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo` allows the application to know the resolution information of a specific use case.

Applications can know the resolution information of `https://developer.android.com/reference/androidx/camera/core/Preview` before a `https://developer.android.com/reference/androidx/camera/core/SurfaceRequest` is received, or know the resolution information of `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis` before an `https://developer.android.com/reference/androidx/camera/core/ImageProxy` is received from `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis.Analyzer`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#ResolutionInfo(android.util.Size,android.graphics.Rect,int)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/Size.html resolution, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Rect.html cropRect, int rotationDegrees )` Creates a new instance of `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo` with the given parameters. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#equals(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html obj)` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Rect.html` | `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#getCropRect()()` Returns the crop rectangle. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/Size.html` | `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#getResolution()()` Returns the output resolution used for the use case. |
| `int` | `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#getRotationDegrees()()` Returns the rotation degrees needed to transform the output resolution to the target rotation. |
| `int` | `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#hashCode()()` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#toString()()` |

## Public constructors

### ResolutionInfo

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

```
public ResolutionInfo(
    @NonNull Size resolution,
    @NonNull Rect cropRect,
    int rotationDegrees
)
```

Creates a new instance of `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo` with the given parameters. This constructor is not normally needed outside of testing cases.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/Size.html resolution` | The resolution used for the `https://developer.android.com/reference/androidx/camera/core/UseCase` expressed in the coordinates of the camera sensor. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/graphics/Rect.html cropRect` | The crop rectangle specifies the region of valid pixels in the buffer. |
| `int rotationDegrees` | The clockwise rotation in degrees that needs to be applied to the output buffer so the image appears upright at the target rotation setting. Value is one of the following: - `0` - `90` - `180` - `270` <br /> |

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#getResolution()` |   |
| `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#getCropRect()` |   |
| `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#getRotationDegrees()` |   |

## Public methods

### equals

```
public boolean equals(@Nullable Object obj)
```

### getCropRect

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

```
public @NonNull Rect getCropRect()
```

Returns the crop rectangle.

The crop rectangle specifies the region of valid pixels in the buffer, using coordinates from `(0, 0)` to the `(width, height)` of the resolution obtained by `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#getResolution()`. The dimensions need to be flipped by the rotation degrees obtained via `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#getRotationDegrees()` to match the target rotation setting.

If the use case is configured with a `https://developer.android.com/reference/androidx/camera/core/ViewPort`, this value is calculated based on the configuration of `https://developer.android.com/reference/androidx/camera/core/ViewPort`; if not, it returns the full rect of the buffer which the dimensions will be the same as the value obtained from `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#getResolution()`.

### getResolution

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

```
public @NonNull Size getResolution()
```

Returns the output resolution used for the use case.

The resolution will be expressed in the coordinates of the camera sensor. The dimensions need to be flipped by the rotation degrees obtained via `https://developer.android.com/reference/androidx/camera/core/ResolutionInfo#getRotationDegrees()` to match the target rotation setting.

### getRotationDegrees

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

```
public int getRotationDegrees()
```

Returns the rotation degrees needed to transform the output resolution to the target rotation.

This is a clockwise rotation in degrees that needs to be applied to the output buffer so the image appears upright at the target rotation setting. The rotation will be determined by the camera sensor orientation value and target rotation setting.

Value is one of the following:

- `0`
- `90`
- `180`
- `270`

<br />

| Returns |
|---|---|
| `int` | The rotation in degrees which will be a value in {0, 90, 180, 270}. |

### hashCode

```
public int hashCode()
```

### toString

```
public @NonNull String toString()
```