You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@Hamahmi Using fit() will affect the images aspect ratio @samuelowino A better way is to write your own Transformation based on your needs, in my case width is more important
class ScaleToFitWidthHeightTransformation(
private val targetWidth: Int,
private val uniqueKey: String
) : Transformation {
override fun transform(source: Bitmap): Bitmap {
val scale: Float = targetWidth.toFloat() / source.width
val targetHeight: Int = (source.height * scale).roundToInt()
val scaleBitmap: Bitmap = Bitmap.createScaledBitmap(source, targetWidth, targetHeight, true)
if (scaleBitmap != source) source.recycle()
return scaleBitmap
}
override fun key(): String {
return uniqueKey
}
}
Here I will share my implementation based on this gist
Fails in picasso:2.71828
Breaking point :PicassoDrawable.java line 47
Stacktrace:
I expected Picasso to compress the image incase it was too large or atleast fail silently.
Thanks in advance.
The text was updated successfully, but these errors were encountered: