Android examples for Graphics:Bitmap Color
set Bitmap Alpha
//package com.java2s; import android.graphics.Bitmap; import android.graphics.Bitmap.Config; public class Main { public static Bitmap setAlpha(Bitmap sourceImg, int number) { int[] argb = new int[sourceImg.getWidth() * sourceImg.getHeight()]; sourceImg.getPixels(argb, 0, sourceImg.getWidth(), 0, 0, sourceImg.getWidth(), sourceImg.getHeight()); number = number * 255 / 100;//from w ww . j a va 2s . c o m for (int i = 0; i < argb.length; i++) { argb[i] = (number << 24) | (argb[i] & 0x00FFFFFF); } sourceImg = Bitmap.createBitmap(argb, sourceImg.getWidth(), sourceImg.getHeight(), Config.ARGB_8888); return sourceImg; } }