# ImageCapture.OutputFileOptions.Builder

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/ImageCapture.java+class:androidx.camera.core.ImageCapture.OutputFileOptions.Builder) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/camera#1.0.0)

*** ** * ** ***


```
public final class ImageCapture.OutputFileOptions.Builder
```

<br />

*** ** * ** ***

Builder class for `https://developer.android.com/reference/androidx/camera/core/ImageCapture.OutputFileOptions`.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/camera/core/ImageCapture.OutputFileOptions.Builder#Builder(java.io.File)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/io/File.html file)` Creates options to write captured image to a `https://developer.android.com/reference/java/io/File.html`. |
| `https://developer.android.com/reference/androidx/camera/core/ImageCapture.OutputFileOptions.Builder#Builder(java.io.OutputStream)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/io/OutputStream.html outputStream)` Creates options that write captured image to a `https://developer.android.com/reference/java/io/OutputStream.html`. |
| `https://developer.android.com/reference/androidx/camera/core/ImageCapture.OutputFileOptions.Builder#Builder(android.content.ContentResolver,android.net.Uri,android.content.ContentValues)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/ContentResolver.html contentResolver, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/net/Uri.html saveCollection, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/ContentValues.html contentValues )` Creates options to write captured image to `https://developer.android.com/reference/android/provider/MediaStore.html`. |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/ImageCapture.OutputFileOptions` | `https://developer.android.com/reference/androidx/camera/core/ImageCapture.OutputFileOptions.Builder#build()()` Builds `https://developer.android.com/reference/androidx/camera/core/ImageCapture.OutputFileOptions`. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/ImageCapture.OutputFileOptions.Builder` | `https://developer.android.com/reference/androidx/camera/core/ImageCapture.OutputFileOptions.Builder#setMetadata(androidx.camera.core.ImageCapture.Metadata)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/ImageCapture.Metadata metadata)` Sets the metadata to be stored with the saved image. |

## Public constructors

### Builder

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

```
public Builder(@NonNull File file)
```

Creates options to write captured image to a `https://developer.android.com/reference/java/io/File.html`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/io/File.html file` | save location of the image. |

### Builder

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

```
public Builder(@NonNull OutputStream outputStream)
```

Creates options that write captured image to a `https://developer.android.com/reference/java/io/OutputStream.html`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/io/OutputStream.html outputStream` | save location of the image. |

### Builder

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

```
public Builder(
    @NonNull ContentResolver contentResolver,
    @NonNull Uri saveCollection,
    @NonNull ContentValues contentValues
)
```

Creates options to write captured image to `https://developer.android.com/reference/android/provider/MediaStore.html`. Example:

```
ContentValues contentValues = new ContentValues();
contentValues.put(MediaStore.MediaColumns.DISPLAY_NAME, "NEW_IMAGE");
contentValues.put(MediaStore.MediaColumns.MIME_TYPE, "image/jpeg");

ImageCapture.OutputFileOptions options = new ImageCapture.OutputFileOptions.Builder(
        getContentResolver(),
        MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
        contentValues).build();
```

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/ContentResolver.html contentResolver` | to access `https://developer.android.com/reference/android/provider/MediaStore.html` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/net/Uri.html saveCollection` | The URL of the table to insert into. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/ContentValues.html contentValues` | to be included in the created image file. |

## Public methods

### build

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

```
public @NonNull ImageCapture.OutputFileOptions build()
```

Builds `https://developer.android.com/reference/androidx/camera/core/ImageCapture.OutputFileOptions`.

### setMetadata

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

```
public @NonNull ImageCapture.OutputFileOptions.Builder setMetadata(@NonNull ImageCapture.Metadata metadata)
```

Sets the metadata to be stored with the saved image.

For JPEG this will be included in the EXIF.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/camera/core/ImageCapture.Metadata metadata` | Metadata to be stored with the saved image. For JPEG this will be included in the EXIF. |