The Logo i.e Circle is png image and its quality decreases like shown. Before posting this question, I referred to all the possible solutions from Stackoverflow but none of them work for me.
To resize the size of pictures according to my usage I'm currently using the method down below.
fun BITMAP_RESIZER(bitmap: Bitmap, newWidth: Int, newHeight: Int): Bitmap? {
val scaledBitmap = Bitmap.createBitmap(newWidth, newHeight, Bitmap.Config.ARGB_8888)
val ratioX = newWidth / bitmap.width.toFloat()
val ratioY = newHeight / bitmap.height.toFloat()
val middleX = newWidth / 2.0f
val middleY = newHeight / 2.0f
val scaleMatrix = Matrix()
scaleMatrix.setScale(ratioX, ratioY, middleX, middleY)
val canvas = Canvas(scaledBitmap)
canvas.setMatrix(scaleMatrix)
canvas.drawBitmap(
bitmap,
middleX - bitmap.width / 2,
middleY - bitmap.height / 2,
Paint(Paint.FILTER_BITMAP_FLAG)
)
return scaledBitmap
}
And as a result, you can see its quality still not improved. Apart from this solution, I have used all other methods but none works for me.
Can you let me know what is the exact thing I'm doing wrong or any other possible answer?