Skip to main content
Camera Kit iOS

Portrait Mode

Overview

When the Portrait Mode is enabled, it applies a Lens that blurs the background behind a person when they are the object of capture in the Camera.

Portrait Mode example

Sample Apps

Sample apps that demonstrate how to implement Portrait Mode and other Camera Kit features are available for you to reference and download on GitHub.

iOS Implementation

To implement the Portrait Mode in your iOS application, use the iOS Camera Kit SDK, which includes SCCameraKitPortraitAdjustment.


Adjust Blur Amount:

The PortraitAdjustmentController makes adjustments for portrait mode. The amount value on controls how much to blur the background on the input.

private var portraitController: PortraitAdjustmentController?

if cameraKit.adjustments.processor?.isAdjustmentAvailable(PortraitAdjustment()) {
portraitController = try? cameraKit.adjustments.processor?.apply(adjustment:PortraitAdjustment())
}

In the sample app, the portraitController is also owned by the CameraController, which conforms to AdjustmentControlViewDelegate.


Detect Portrait Mode Availability:

If you have any UI for adjusting portrait settings, we recommend that you show it only when portrait mode is available. You can conform the class that shows the UI to AdjustmentsProcessorObserver, to listen for changes in availability.

public func processorUpdatedAdjustmentsAvailability(_ adjustmentsProcessor: AdjustmentsProcessor) {
cameraActionsView.portraitActionView.isHidden = !isPortraitAdjustmentAvailable
}
Was this page helpful?
Yes
No

AI-Powered Search