Image Editing
The Image Module SDK provides a set of intuitive and powerful image editing tools. This SDK allows developers to seamlessly integrate rich image editing features into their iOS applications.
Prerequisites
Before you begin editing images, ensure:
The TruVideo Core SDK is integrated into your project.
Authentication has been completed.
You have access to a valid image file path.
Edit an Image
Step 1: Initialize the Image Editor Preset
Set up a configuration using the TruvideoSdkImageEditorPreset
. This defines the input and output image paths.
let configuration = TruvideoSdkImageEditorPreset(
imageURL: inputUrl, // Input image URL
outputURL: outputUrl // Output path for the edited image
)
Step 2: Present the Image Editor View
Launch the image editor using a view controller:
viewController.presentTruvideoSdkImageEditorView(
preset: configuration,
onComplete: { result in
// Retrieve the edited UIImage object
let editedImage: UIImage = result.editedImage ?? UIImage()
// Optional: Access the file URL of the edited image (iOS 16+)
if #available(iOS 16.0, *) {
let editedImageURL: URL = result.editedImageURL ?? URL(filePath: "")
}
}
)
Final Implementation
Here’s what a complete integration might look like:
import Foundation
import TruvideoSdkImage
import UIKit
class ImageModule: NSObject {
func editImage(inputUrl: URL, outputUrl: URL, viewController: UIViewController) {
// Step 1: Initialize image editor configuration
let configuration = TruvideoSdkImageEditorPreset(
imageURL: inputUrl,
outputURL: outputUrl
)
// Optional: Initialize using a UIImage instead of a URL
// let configuration = TruvideoSdkImageEditorPreset(
// image: inputImage,
// outputURL: outputUrl
// )
// Step 2: Present the image editor
viewController.presentTruvideoSdkImageEditorView(
preset: configuration,
onComplete: { result in
// Handle edited image
let editedImage: UIImage = result.editedImage ?? UIImage()
if #available(iOS 16.0, *) {
let editedImageURL: URL = result.editedImageURL ?? URL(filePath: "")
}
}
)
}
}
Final Result -

Learn More
Explore advanced capabilities of the Image Module in the Image Module Reference.
Last updated
Was this helpful?