2

I am currently using FFImageLoading package to do caching etc to show on the ui. I am unsure whether FFImageLoading have function to resize the image itself so i can save it and send over the internet.

Cœur
  • 34,719
  • 24
  • 185
  • 251
LittleFunny
  • 7,771
  • 14
  • 78
  • 184

1 Answers1

5

It's as easy as:

var stream = await ImageService.Instance.LoadFile("someimage.png")
     .DownSample(width: 200)
     .AsPNGStreamAsync();
Daniel Luberda
  • 7,204
  • 1
  • 29
  • 39
  • I can't find AsPNGStreamAsync and cannot await as well – LittleFunny Sep 03 '17 at 05:11
  • @LittleFunny: You must use `using FFImageLoading` at the top of your file. – testing Jun 25 '20 at 13:31
  • The algorithm behind this function uses [`inSampleSize`](https://developer.android.com/reference/android/graphics/BitmapFactory.Options#inSampleSize), which doesn't give you the exact size you asked for. – testing Jun 25 '20 at 13:33
  • I'm using `CopyStream` from [this answer](https://stackoverflow.com/a/411605/426227) for storing the result into a file. – testing Jun 25 '20 at 13:36
  • @Daniel Luberda, how to get path from stream of new re-sized image? plz help –  May 31 '21 at 18:34