mducc
mducc

Reputation: 743

Resize an image to a bitmap in Android

I get an image capture from the camera, it has a size of 1440x1080. But I use a bitmap to save it, its size is 1080x720.

val bitmap = BitmapFactory.decodeByteArray(bytes, 0, bytes.lastIndex)

What can I do to fix it?

Upvotes: 0

Views: 427

Answers (1)

Priyank Patel
Priyank Patel

Reputation: 12382

Try using below code.

val b =  BitmapFactory.decodeByteArray(bytes, 0, bytes.lastIndex)
var bitmap = Bitmap.createScaledBitmap(b, 720, 1080, false)

Upvotes: 1

Related Questions