I have the following images :
And I have the following method that returns me the Palette color from the bitmap of this images :
public static int getPredominantColorFromPokemon(String pokemonId, Context context) {
int pokemonImage = PokemonUtils.getPokemonSugimoriImageById(pokemonId, context);
if (pokemonImage == 0) {
return Color.WHITE;
}
Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), pokemonImage);
Palette palette = Palette.from(bitmap).generate();
int colorPalette1 = palette.getLightVibrantColor(Color.WHITE);
int colorPalette2 = colorPalette1 == -1 ? palette.getVibrantColor(Color.WHITE) : colorPalette1;//Fallback
int colorPalette3 = colorPalette2 == -1 ? palette.getLightMutedColor(Color.WHITE) : colorPalette2; //Fallback
int colorPalette4 = colorPalette3 == -1 ? palette.getDominantColor(Color.WHITE) : colorPalette3;//Fallback
return colorPalette4;
}
The result colors of this 3 images is the following :
However , this isn't what im looking for , my desired output would be this :
The first and second image results are OK , the background is a kind of green because the predominant color is green but in the case of the third image (Venusaur) is not because the result is a kind of pink/purple color and I want the Palette to detect green instead . How can I modify my method in order to detect the PREDOMINANT colors ?