开发者

how to force a photo into black and white

开发者 https://www.devze.com 2023-02-17 09:24 出处:网络
So if the user takes a photo in color, I want to save it as a black and white pictur开发者_Go百科e.

So if the user takes a photo in color, I want to save it as a black and white pictur开发者_Go百科e.

Could someone help me?


you have to set camera parameter by see parameter


If you've got a rather crappy phone (I do - Xperia X8), then you won't be able to apply any color effects at all. To find out what color effects are supported by your phone, you could use something like this:

Camera.Parameters params = cam.getParameters();

try {           
    for (String e : params.getSupportedColorEffects()) {
        Log.d(TAG, "Effect: " + e);
    }
}
catch (NullPointerException npe) {
    Log.d(TAG, "No color effects supported by this camera.");           
}


cameraParams.getSupportedColorEffect(); and check if it contains Parameters.EFFECT_MONO then set

cameraParams.setColorEffect(android.hardware.Camera.Parameters.EFFECT_MONO);

mCamera.setParameters(cameraParams);
0

精彩评论

暂无评论...
验证码 换一张
取 消