chooyan-eng / crop_your_image

A flutter plugin which provides Crop Widget for cropping images.
https://pub.dev/packages/crop_your_image
Apache License 2.0
163 stars 139 forks source link

Too long cropping image at Web Platform #45

Open mmuttaqin opened 3 years ago

mmuttaqin commented 3 years ago

I have issue too long when cropping image at Web Platform - At android running well. Need improvement at cropping process at web platform

Thanks

Donk3ys commented 3 years ago

Second this... awesome package but web takes forever to load / crop image

chooyan-eng commented 3 years ago

Thank you for your feedback. I'll check this. Unfortunately crop_your_image is not well tested at Web Platform as I'm not familiar with Web.

For now, can you check the issue below is related? https://github.com/chooyan-eng/crop_your_image/issues/33#issuecomment-830710454

Donk3ys commented 3 years ago

@chooyan-eng Thanks for the reply.

After looking at other cropping tools in flutter it seems that most of them do the image processing on separate process or isolate.

Flutter web doesn't allow to run an isolate and running an html worker could be the trick but I think that would be quite difficult to implement.

So until Flutter decide to implement isolates for web it might be a difficult issue to fix.

leonardojribeiro commented 3 years ago

Hi! I believe using the dart:ui package and CustomPainter for image manipulation can be a solution for flutter web. I found considerable performance with the following changes.

In decode, but without orientation. image In crop image

mdrideout commented 2 years ago

Try using release mode on Flutter web (build with --release. It's quite a bit faster. For me, 5+ seconds down to ~2 seconds. Still long but not unbearable (assuming the image is under 1MB). It's still too long for large images.

Hannnes1 commented 1 year ago

I believe something like https://github.com/deakjahn/flutter_isolate_web would be a good solution. I will take a look at it as soon as I have time

mdrideout commented 1 year ago

I built a standalone package for cropping on web using the GPU acceleration of the HTML Canvas. A similar approach could be integrated into this package.

https://pub.dev/packages/cream_of_the_crop

Hannnes1 commented 1 year ago

I built a standalone package for cropping on web using the GPU acceleration of the HTML Canvas. A similar approach could be integrated into this package.

https://pub.dev/packages/cream_of_the_crop

That does seem like a better approach. I actually like the idea of having the UI and logic in separate packages. Gives a better separation of concerns

c-seeger commented 9 months ago

Any chance this will be addressed soon?