BmpUtils

object BmpUtils

Functions

Link copied to clipboard

Get base64 from bitmap. You can click link to verify the conversion result.

Link copied to clipboard

Get bitmap from base64.

Link copied to clipboard
fun getBitmapFromDrawable(@DrawableRes id: Int, context: Context = ContextHelper.getAppContext()): Bitmap

Convert drawable to bitmap.

Link copied to clipboard

Get bitmap width and height.

Link copied to clipboard
fun mergeBitmap(topBitmap: Bitmap, bottomBitmap: Bitmap, position: MergePosition = MergePosition.LT): Bitmap

Merge the two bitmaps into one bitmap, based on the length and width of the bottomBitmap.

Link copied to clipboard
fun mergeBitmapLR(leftBitmap: Bitmap, rightBitmap: Bitmap, scale: MergeScale = SMALL_ENLARGE): Bitmap

Merge two bitmaps into one bitmap, splicing left and right.

Link copied to clipboard
fun mergeBitmapTB(topBitmap: Bitmap, bottomBitmap: Bitmap, scale: MergeScale = SMALL_ENLARGE): Bitmap

Merge two bitmaps into one bitmap, splicing up and down.

Link copied to clipboard
fun saveBitmapAsFile(bitmap: Bitmap, file: File, format: Bitmap.CompressFormat = Bitmap.CompressFormat.JPEG, @IntRange(from = 0, to = 100) quality: Int = 100): File?

Store the Bitmap object under the local cache folder.

Link copied to clipboard
fun scaleBitmap(bitmap: Bitmap, @IntRange(from = 0) reqWidth: Int, @IntRange(from = 0) reqHeight: Int): Bitmap

Scale bitmap