Think I have an bitmap that I have loaded it from Album Art in Media Store , It has 100 percent transparent value , how can I change that to 50 or 30 ?
Also Do you know any way that I can make image black and white ?
thanks
Think I have an bitmap that I have loaded it from Album Art in Media Store , It has 100 percent transparent value , how can I change that to 50 or 30 ?
Also Do you know any way that I can make image black and white ?
thanks
Set the alpha between 0 to 255!!
alpha set to 45 will make the image transparent
ViewName.getBackground().setAlpha(65);
Use the following method:
/**
* @param bitmap The source bitmap.
* @param opacity a value between 0 (completely transparent) and 255 (completely
* opaque).
* @return The opacity-adjusted bitmap. If the source bitmap is mutable it will be
* adjusted and returned, otherwise a new bitmap is created.
*/
private Bitmap adjustOpacity(Bitmap bitmap, int opacity)
{
Bitmap mutableBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
Canvas canvas = new Canvas(mutableBitmap);
int colour = (opacity & 0xFF) << 24;
canvas.drawColor(colour, PorterDuff.Mode.DST_IN);
return mutableBitmap;
}
Explanation here: http://blog.uncommons.org/2011/01/12/adjusting-the-opacity-of-an-android-bitmap/