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
  • 37,241
  • 25
  • 195
  • 267
LittleFunny
  • 8,155
  • 15
  • 87
  • 198

1 Answers1

5

It's as easy as:

var stream = await ImageService.Instance.LoadFile("someimage.png")
     .DownSample(width: 200)
     .AsPNGStreamAsync();
Daniel Luberda
  • 7,374
  • 1
  • 32
  • 40
  • 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