Image Editor
Get File Path
getFilePath
is function which provide file path of the image or video with name which will be platform specific
List<String> getAllImagePathsInDirectory(String directoryPath) {
final directory = Directory(directoryPath);
List<String> imagePaths = [];
if (directory.existsSync()) {
directory.listSync(recursive: true).forEach((file) {
if (file is File && ['png', 'jpeg', 'jpg'].contains(file.path.split('.').last.toLowerCase())) {
imagePaths.add(file.path);
}
});
}
return imagePaths;
}
Launch Image Editing
launchImageEdit function launches the editing screen for image
void editImage(String imagePath) async {
final resultPath = "${widget.directoryPath}/editImage_${timestamp}.png"
TruvideoImageSdk.editImage(
inputPath: imagePath,
outputPath: resultPath,
onResult: (String? result) {
print("Image edited successfully: $result");
},
onError: (String? message) {
print("Image editing failed: $message");
},
);
}
Last updated
Was this helpful?