-
Notifications
You must be signed in to change notification settings - Fork 132
-
Content
Is there any trick or how to use this plugin properly when dealing with large image?
I think it is too slow, like when just do a rotation, on a large image.
It pause a while, around 3-5 sec, to do a just rotation.
So any tips? below is my code snippet
Future<void> _rotate(RotateOption rotateOpt) async {
_handleOption(<Option>[rotateOpt]);
}
Future<void> _handleOption(List<Option> options) async {
for (int i = 0; i < options.length; i++) {
final Option o = options[i];
imageEditorOption.addOption(o);
}
final Uint8List? result = await ImageEditor.editImage(
image: editedImageByte!,
imageEditorOption: imageEditorOption,
);
if (result == null) {
_setImageProvider(null);
return;
}
editedImageByte = result;
final MemoryImage img = MemoryImage(result);
_setImageProvider(img);
}
void _setImageProvider(ImageProvider? provider) {
this.provider = provider;
setState(() {});
}
onPressed: () {
_rotate(const RotateOption(90));
},
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 1 reply
-
This library does not use any third-party dependencies when processing images, and only uses native methods provided by iOS/android. Compared with many other excellent third-party image processing libraries, it is not good enough, it is only available and faster than some native implementations using dart.
I know that c language libraries such as libvips are excellent, but unfortunately libvips does not provide native libraries for android and iOS. If you have extreme requirements for performance, you can try opencv or find a ffi image library that provides dart bindings.
Beta Was this translation helpful? Give feedback.
All reactions
-
In addition, if you just want to rotate the picture and your picture is jpeg, you can do it by modifying the exif orientation information, but if it involves more operations such as cropping, modifying exif is not enough.
Beta Was this translation helpful? Give feedback.