icapps/flutter-custom-image-crop

cropped image can't keep high quality

ZMNOTZ opened this issue · 15 comments

I don’t know if you find that the picture after cropped is a jagged picture

Right now the picture will be the size of your canvas. This is something what we still need to fix.

image
image

Can you see the obvious change?

Yes indeed. This is on our radar we will fix that. But pull requests are always welcome

It's caused by the canvas!!! I also encounter this situation when I use the canvas. The picture on the canvas is not clear and I don’t know how to solve it.😂

It is because at first the image is using its correct size. Then you resize it so it fits your shape. When clicking crop the canvas is used to get the new image instead of the original image.

I set the size of the canvas when I created the canvas, but it didn’t work

That is why we have to use the original image instead of the canvas. We will take a look at it

It seems that there is no way to do it in flutter, only use canvas.

Yes there is :D you can do the image processing just in dart

Maybe the CustomClipper component can do it

The custom clipper is used on the canvas so that will result in the same problem

It should be possible to use CustomClipper and RenderRepaintBoundary components. I used RenderRepaintBoundary to take screenshots. The image quality can be adjusted according to pixelRatio.

Yes that is possible, but that will still limit your max width & height to the max width & height of your canvas. If you are using an image of 2000x2000 and a device of 480x 640 your image will only have a max width & height of 480x640 (x pixel ratio)

So there were two issues that caused this. One is that the image returned is depending on the screen size and the other one is filterQuality not set correctly. I've updated both and will create a PR asap.
This is the result:
image

Versino 0.0.3 is available that fixes this issue