Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .idea/runConfigurations.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ fun Bitmap.base64(): String {
}

fun Bitmap.resize(newWidth: Int, newHeight: Int): Bitmap {
return Bitmap.createScaledBitmap(this, newWidth, newHeight, false)
val scaleWidth = newWidth.toFloat() / width
val scaleHeight = newHeight.toFloat() / height
val matrix = Matrix()
matrix.postScale(scaleWidth, scaleHeight)
val resizedBitmap = Bitmap.createBitmap(
this, 0, 0, width, height, matrix, false)
this.recycle()
return resizedBitmap
}

/**
Expand Down