core-ktx / / / scale


inline fun Bitmap.scale(width: Int, height: Int, filter: Boolean = true): Bitmap

Creates a new bitmap, scaled from this bitmap, when possible. If the specified width and height are the same as the current width and height of this bitmap, this bitmap is returned and no new bitmap is created.


width - The new bitmap's desired width

height - The new bitmap's desired height

filter - true if the source should be filtered (true by default)

The new scaled bitmap or the source bitmap if no scaling is required.