Home > front end >  Force function to pick a dark shade from image instaed of Light One
Force function to pick a dark shade from image instaed of Light One

Time:12-09

I have created this function to pick color from image.


fun getMainColor(img: Bitmap): Int {
    val newImg = Bitmap.createScaledBitmap(img, 1, 1, true)
    val color = newImg.getPixel(0, 0)
    newImg.recycle()
    return color
}

But it usually chooses a Light Shade color that makes the UI so Ugly, I want it to Choose a dark shade from the image. How Could I do that!

CodePudding user response:

Palette API is good solution for find the colors from the Image with multiple choices.

  • Related