Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Discussions] Too slow when the image source is large #110

Unanswered
tong-k-k asked this question in Q&A
Discussion options

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));
 },
You must be logged in to vote

Replies: 1 comment 1 reply

Comment options

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.

You must be logged in to vote
1 reply
Comment options

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #108 on April 15, 2023 03:03.

AltStyle によって変換されたページ (->オリジナル) /