0
votes

I want to remove pixels from Bitmap. Here is my for loop that goes through all pixels in Bitmap:

input and output are both Bitmaps.

for(int x = 0; x<input.getWidth(); x++){
            for(int y = 0; y<input.getHeight(); y++){               
                if(output.getPixel(x, y) == input.getPixel(x, y)){
                    output.setPixel(x, y, Color.WHITE); // changes color to white
                }
            }
        }

but I'd like to remove the pixel and not only change its color. Is that possible? I am later adding shadow to that bitmap based on its shape, so making it transparent doesn't help me in this case.

1

1 Answers

2
votes

You mean make it transparent? Write a color with an alpha value of zero. setPixel(x,y,0) should do nicely.