- Simple Transformation class to blur an image for Picasso
- Blur time: 1-3 ms*
Picasso.get().load(YOUR_URL).transform(BlurTransform(scale = 0.1f,radius = 1)).into(YOUR_IMAGE_VIEW)
BlurTransform takes 2 parameters
- scale
- radius
val width = Math.round(sentBitmap.width * scale)
val height = Math.round(sentBitmap.height * scale)
It is recommened not to pass a number higher then 1 (your origial bitmap size), as it will requere extra time to prosses & huge memory allocations
Additional notes: You can't pass 0, as this will thow an exeption.
Higher the number - more blur Very high numbers will increase prossesing time It is recomened to keep your number between 1 and 50 You can not pass 0, as this will thow an exeption.
Scale | Radius | Output |
---|---|---|
0.1 | 1 | Add image |
0.1 | 10 | Add image |
0.5 | 5 | Add image |
*Time is milliseconds *Big bitmaps were used for performnce test (width = 5000px, height = 3000px)
Scale | 0.1 | 0.1 | 0.1 | 0.1 | 0.1 |
Radius | 1 | 10 | 20 | 50 | 100 |
Time | 3 | 6 | 15 | 16 | 35 |
It is recommened to use scale between 0.1 and 1
The Best Performace Between 0.1 And 0.5
Scale | 1 | 1 | 1 | 1 | 1 |
Radius | 1 | 10 | 20 | 50 | 100 |
Time | 48 | 52 | 57 | 82 | 117 |
Scale | 5 | 5 | 5 | 5 | 5 |
Radius | 1 | 10 | 20 | 50 | 100 |
Time | 766 | 886 | 1054 | 1443 | 1581 |
Test device: Huawei P9 Android OS: 7.0