Open top menu



How to change Background color Bitmap image in Android?



public Bitmap EreasBackground(Bitmap c) {
    Bitmap imageWithBG = Bitmap.createBitmap(c.getWidth(), c.getHeight(), c.getConfig());
    imageWithBG.eraseColor(Color.
WHITE);  // set its background to white, or whatever color you want
   
Canvas canvas = new Canvas(imageWithBG);  // create a canvas to draw on the new image
   
canvas.drawBitmap(c, 0f, 0f, null); // draw old image on the background
   
c.recycle();  // clear out old image
   
return imageWithBG;
}
Tagged

0 comments