# Capture a processed photo on iOS

> Capture the current Nosmai preview as a UIImage after the active effects have been rendered.

> For AI agents: the complete documentation index is at https://nosmai.com/llms/effects.txt

Product: Nosmai Effects
Group: guide
Source: https://nosmai.com/docs/effects/guides/output/capture-a-photo/ios/

## Prerequisites

- A working [iOS quickstart](/docs/effects/quickstart/ios/)
- An active camera preview

## Capture the processed frame

```objective-c
[[NosmaiCore shared] capturePhoto:^(UIImage *image, NSError *error) {
    dispatch_async(dispatch_get_main_queue(), ^{
        if (image != nil) {
            self.photoPreview.image = image;
            return;
        }

        NSLog(@"Nosmai photo capture failed: %@", error.localizedDescription);
    });
}];
```

The returned image includes the effects visible in the Nosmai preview. The SDK
does not save it to Photos automatically.

## Save only when requested

Add `NSPhotoLibraryAddUsageDescription` to `Info.plist` before saving to the
user's photo library. Keep capture and save as separate actions so the user can
review or discard the image first.

## Verify it worked

Apply a visible effect, capture once, and compare the returned `UIImage` with
the preview. Confirm that the completion block returns no error.

## Common errors

| Symptom | Cause | Fix |
| --- | --- | --- |
| `image` is nil | The camera or processing pipeline is not ready | Capture after the processed preview is visible and inspect `error` |
| Saving to Photos fails | The app is missing photo-library permission | Add `NSPhotoLibraryAddUsageDescription` and request access before saving |

## Next steps

- [Record processed video on iOS](/docs/effects/guides/output/record-video/ios/)
- [Add an AR mask on iOS](/docs/effects/guides/effects/add-an-ar-mask/ios/)

## References

- [iOS platform guide](/docs/effects/platforms/ios/)
- [Troubleshooting](/docs/effects/troubleshooting/)
