Can any one help to combine two bitmap images into single bitmap
in android (Side by side).
Thanks, Yuvaraj
I ended up modifying xil3's answer into a kotlin extension function, maybe it will be useful to someone. In my case I wanted the images stacked vertically
fun Bitmap?.combine(b: Bitmap?): Bitmap? =
when {
b == null || this == null -> {
this ?: b
} else -> {
val cs = Bitmap.createBitmap(
max(this.width, b.width),
this.height + b.height,
Bitmap.Config.ARGB_8888
)
val canvas = Canvas(cs)
canvas.drawBitmap(this, 0f, 0f, null)
canvas.drawBitmap(b, 0f, this.height.toFloat(), null)
cs
}
}