I want to convert white background to a transparent background in Android bitmap.
My Status:
Original Image: I can not post an image
instead of changing the public bitmap (bitmap source) {if ( Src == null) return null; Int width = src.getWidth (); Int height = src.getHeight (); Int [] pixels = new int [width * height]; Src.getPixels (pixels, 0, width, 0, 0, width, height); For (int x = 0; x & lt; pixels.length; ++ x) {pixels [x] = ~ (pixels [x] & lt; 8 & amp; 0xFF000000) & amp; Art color; } Bitmap result = bitmap.creditbetaMap (pixels, width, height, bitmap config.Argb_8888); Return result; } After processing, the pixels were detected by pixels one by one. This is good, but this bitmap image is not the original color.
Then, I attach the code to the filter.
if (pixels [x] == Color.white) public bitmap replacement replacement (bitmap source) {if (src == null) return null; Int width = src.getWidth (); Int height = src.getHeight (); Int [] pixels = new int [width * height]; Src.getPixels (pixels, 0, width, 0, 0, width, height); (Pixels [x] == color. WHITE) {pixels [x] = ~ (pixels [x] After that processing,
But, this picture can not completely remove the color white. So, this is not beautiful
I really want to remove the white background in the Android bitmap
My code is under stack overflow article.
No comments:
Post a Comment