# CameraController.OutputSize

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/CameraController.java+class:androidx.camera.view.CameraController.OutputSize) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/camera#1.1.0) Deprecated in [1.4.0](https://developer.android.com/jetpack/androidx/releases/camera#1.4.0)

*** ** * ** ***


```
public final class CameraController.OutputSize
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
>
> Use `https://developer.android.com/reference/androidx/camera/core/resolutionselector/ResolutionSelector` instead.

Represents the output size of a `https://developer.android.com/reference/androidx/camera/core/UseCase`.

This class is a preferred output size to be used with `https://developer.android.com/reference/androidx/camera/view/CameraController`. The preferred output size can be based on either resolution or aspect ratio, but not both.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/view/CameraController#setImageAnalysisTargetSize(androidx.camera.view.CameraController.OutputSize)` |   |
| `https://developer.android.com/reference/androidx/camera/view/CameraController#setPreviewTargetSize(androidx.camera.view.CameraController.OutputSize)` |   |
| `https://developer.android.com/reference/androidx/camera/view/CameraController#setImageCaptureTargetSize(androidx.camera.view.CameraController.OutputSize)` |   |

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize#UNASSIGNED_ASPECT_RATIO() = -1` **This field is deprecated.** Deprecated in Java |

| ### Public constructors |
|---|
| `[OutputSize](https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize#OutputSize(int))(int aspectRatio)` **This method is deprecated.** Deprecated in Java |
| `[OutputSize](https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize#OutputSize(android.util.Size))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/util/Size.html resolution)` **This method is deprecated.** Deprecated in Java |

| ### Public methods |
|---|---|
| `int` | `[getAspectRatio](https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize#getAspectRatio())()` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/util/Size.html` | `[getResolution](https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize#getResolution())()` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `[toString](https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize#toString())()` **This method is deprecated.** Deprecated in Java |

## Constants

### UNASSIGNED_ASPECT_RATIO

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

```
public static final int UNASSIGNED_ASPECT_RATIO = -1
```

> [!CAUTION]
> **This field is deprecated.**   
> Deprecated in Java

A value that represents the aspect ratio is not assigned.

## Public constructors

### OutputSize

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

```
public [OutputSize](https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize#OutputSize(int))(int aspectRatio)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Creates a `https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize` that is based on aspect ratio.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/Preview.Builder#setTargetAspectRatio(int)` |   |
| `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis.Builder#setTargetAspectRatio(int)` |   |

### OutputSize

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

```
public [OutputSize](https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize#OutputSize(android.util.Size))(@NonNull Size resolution)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Creates a `https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize` that is based on resolution.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/camera/core/Preview.Builder#setTargetResolution(android.util.Size)` |   |
| `https://developer.android.com/reference/androidx/camera/core/ImageAnalysis.Builder#setTargetResolution(android.util.Size)` |   |

## Public methods

### getAspectRatio

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

```
public int [getAspectRatio](https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize#getAspectRatio())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Gets the value of aspect ratio.

Value is one of the following:

- `AspectRatio.RATIO_4_3`
- `AspectRatio.RATIO_16_9`

<br />

| Returns |
|---|---|
| `int` | `https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize#UNASSIGNED_ASPECT_RATIO()` if the size is not based on aspect ratio. |

### getResolution

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

```
public @Nullable Size [getResolution](https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize#getResolution())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Gets the value of resolution.

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/util/Size.html` | `null` if the size is not based on resolution. |

### toString

```
public @NonNull String [toString](https://developer.android.com/reference/androidx/camera/view/CameraController.OutputSize#toString())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java