android 为图片去灰
图片去色,返回黑白的图片,具体的方法就是为bitmap添加colorFilter
public static Bitmap getGreyImage(Bitmap old) { int width, height; height = old.getHeight(); width = old.getWidth(); Bitmap new= Bitmap.createBitmap(width, height, Bitmap.Config.RGB_565); Canvas c = new Canvas(old); Paint paint = new Paint(); ColorMatrix cm = new ColorMatrix(); cm.setSaturation(0); ColorMatrixColorFilter f = new ColorMatrixColorFilter(cm); paint.setColorFilter(f); c.drawBitmap(new, 0, 0, paint); return new; }