FFImageLoading icon indicating copy to clipboard operation
FFImageLoading copied to clipboard

The image with large size how to reduce it?

Open mcguu opened this issue 4 years ago • 4 comments

💬 Questions and Help

I have Images usually over 5MB and if there is some images it will not scroll smoothly.

but the image to be 100 * 100 pixel is ok.

will the FFImageLoading auto reduce the size of it when I set the source with Image over 5MB?

mcguu avatar Jun 25 '21 02:06 mcguu

If you want to be certain you can do something along the lines of: await ImageService.Instance.LoadStream(token => photo.OpenReadAsync()) .DownSample(500, 500)

mikkelAtVisma avatar Jun 30 '21 13:06 mikkelAtVisma

You can use .DownSample(100) to reduce the size

aliusman avatar Jul 09 '21 01:07 aliusman

@aliusman thankyou and how to use it in xaml?

mcguu avatar Jul 09 '21 02:07 mcguu

@mcguu In XML you need to set the layout_width and layout_heigh for your ImageView for example

<ImageView
    android:layout_width="100dp"
    android:layout_height="100dp"    
    ...
/>

Please remember that, this does not mean the image size will be reduced in memory/heap, FFImageLoading will load full image as is (5MB for example) and ImageView will scale the image size.

If you really want to reduce the size of an image, you should always use .DownSample()

aliusman avatar Jul 09 '21 03:07 aliusman