Android examples for Graphics:Bitmap Effect
Convert Bitmap Image to Transparent
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Color; public class Main { private static void toTransparent(Bitmap src) { int[] pixels = new int[src.getHeight() * src.getWidth()]; src.getPixels(pixels, 0, src.getWidth(), 0, 0, src.getWidth(), src.getHeight());//from w w w . j a v a 2 s. c o m final int length = pixels.length; int transparent = Color.parseColor("#00000000"); for (int i = 0; i < length; i++) { if (pixels[i] == Color.WHITE) pixels[i] = transparent; } src.setPixels(pixels, 0, src.getWidth(), 0, 0, src.getWidth(), src.getHeight()); } }