Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.Bitmap; import android.graphics.Canvas; import android.view.View; public class Main { public static Bitmap convertToAlphaMask(Bitmap b) { Bitmap a = Bitmap.createBitmap(b.getWidth(), b.getHeight(), Bitmap.Config.ALPHA_8); Canvas c = new Canvas(a); c.drawBitmap(b, 0.0f, 0.0f, null); return a; } public static Bitmap createBitmap(View target) { Bitmap b = Bitmap.createBitmap(target.getWidth(), target.getHeight(), Bitmap.Config.ARGB_8888); Canvas c = new Canvas(b); target.draw(c); /* enable this to invert the image: */ //invertImage(b); return b; } }