alexzhirkevich/custom-qr-generator

Use custom logo from gallery

Closed this issue · 2 comments

is there any way to use URI or Bitmap for the logo image?

If URI is from android file system, you can use DrawableSource.File. Otherwise you should pre-download it

You can use BitmapDrawable and create custom DrawableSource:

val bitmapDrawableSource = DrawableSource { 
    BitmapDrawable(resources, yourBitmap) 
    // or yourBitmap.toDrawable(resources)
}

But make sure that your bitmap is immutable. You can check it with Bitmap.isMutable and make bitmap immutable with

val immutableBitmap = yourBitmap.copy(Bitmap.Config.ARGB_8888, /* isMutable= */false)

Thanks. Issue Solved