Black and white photo in android [duplicate]
Possible Duplicate:
how to force a photo into black and white
i want to store Black and white photo when i take photo from mobil开发者_运维百科e camera.
Something like this should work:
public Bitmap greyScaler(Bitmap b) {
Bitmap grayscaleBitmap = Bitmap.createBitmap(b.getWidth(),
b.getHeight(), Bitmap.Config.RGB_565);
Canvas c = new Canvas(grayscaleBitmap);
Paint p = new Paint();
ColorMatrix cm = new ColorMatrix();
cm.setSaturation(0);
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(cm);
p.setColorFilter(filter);
c.drawBitmap(b, 0, 0, p);
return grayscaleBitmap;
}
精彩评论