Image Editing
This documentation outlines the guidelines for utilizing the Image Module SDK, which offers powerful image editing tools. The SDK provides straightforward methods to incorporate advanced image editing functionalities into your
Prerequisites
Ensure you have integrated the TruVideo Core SDK into your project and completed with the authentication process
Camera module will provide MediaItem or simply provide filepath to upload (optional)
Edit an Image
To edit an image, follow these steps:
Step 1 : Get Result File path where to place the save image
This function returns the result path using the provided file name as input.
const resultPath = await getFilePath(`${Date.now()}-editImage.png`);
Step 2 : Call Image Edit
After obtaining the result path, invoke the launchImageEdit
function to edit
// result path will be available from step 1
// media item will be get from camera module or pass string file path
const result = await launchImageEdit(mediaItems.filePath, resultPath);
Finalize :
After completing this steps the function should look like
import { launchImageEdit, getFilePath } from '@trunpm/truvideo-react-turbo-image-sdk';
const editImage = async (mediaItem: MediaItem) => {
try {
// get result path
const resultPath = await getFilePath(`${Date.now()}-editImage.png`);
// launch image editing
const result = await launchImageEdit(mediaItem.filePath, resultPath);
// handle result
console.log('Image edited successfully:', result);
} catch (error) {
// handle error
console.log('Error editing image:', error);
}
};
Last updated
Was this helpful?