fixExifRotation function
Future<File>
fixExifRotation(
- File image, {
- dynamic deleteOriginal = false,
})
Implementation
Future<File> fixExifRotation(File image, {deleteOriginal = false}) async {
List<int> imageBytes = await image.readAsBytes();
List<int> result = await FlutterImageCompress.compressWithList(
Uint8List.fromList(imageBytes),
quality: 100,
rotate: 0,
);
final String processedImageUuid = const Uuid().v4();
String imageExtension = p.basename(image.path);
final String tempPath = (await getTemporaryDirectory()).path;
File fixedImage = File('$tempPath/$processedImageUuid$imageExtension');
await fixedImage.writeAsBytes(result);
if (deleteOriginal) await image.delete();
return fixedImage;
}