# 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)

*** ** * ** ***


```
class CameraController.OutputSize
```

<br />

*** ** * ** ***

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

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

This class is a preferred output size to be used with `https://developer.android.com/reference/kotlin/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/kotlin/androidx/camera/view/CameraController#setImageAnalysisTargetSize(androidx.camera.view.CameraController.OutputSize)` |   |
| `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setPreviewTargetSize(androidx.camera.view.CameraController.OutputSize)` |   |
| `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController#setImageCaptureTargetSize(androidx.camera.view.CameraController.OutputSize)` |   |

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize#UNASSIGNED_ASPECT_RATIO() = -1` **This property is deprecated.** Deprecated in Java |

| ### Public constructors |
|---|
| `[OutputSize](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize#OutputSize(int))(aspectRatio: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` **This function is deprecated.** Deprecated in Java |
| `[OutputSize](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize#OutputSize(android.util.Size))(resolution: https://developer.android.com/reference/android/util/Size.html)` **This function is deprecated.** Deprecated in Java |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `[getAspectRatio](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize#getAspectRatio())()` **This function is deprecated.** Deprecated in Java |
| `https://developer.android.com/reference/android/util/Size.html?` | `[getResolution](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize#getResolution())()` **This function is deprecated.** Deprecated in Java |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `[toString](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize#toString())()` **This function 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)

```
const val UNASSIGNED_ASPECT_RATIO = -1: Int
```

> [!CAUTION]
> **This property 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)

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

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

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

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/camera/core/Preview.Builder#setTargetAspectRatio(int)` |   |
| `https://developer.android.com/reference/kotlin/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)

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

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

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

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

## Public functions

### 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)

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

> [!CAUTION]
> **This function 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 |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/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)

```
fun [getResolution](https://developer.android.com/reference/kotlin/androidx/camera/view/CameraController.OutputSize#getResolution())(): Size?
```

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

Gets the value of resolution.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/util/Size.html?` | `null` if the size is not based on resolution. |

### toString

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

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