프로그래밍/그래픽&이미지

Sepia Tone 방법

panpro 2006. 10. 16. 11:23
Yeah, I take my color and multiply each r,g,b
by the gray value for the pixel:

[r|g|b]1 are inputs
[r|g|b]2 are outputs

gr = 0.30 * r1 + 0.59 * g1 + 0.11 * b1; // get brightness

r2 = gr * 1; // add tint
g2 = gr * 0.71;
b2 = gr * 0.41;

if u don't satisfy the effect of the hue , u can also do some other manipulation.
e.g. increase the contrast
r2 = r2* a;
if(r2 > 255)
r2 = 255;

g2 = g2* a;
if(g2 > 255)
g2 = 255;

b2 = b2* a;
if(b2 > 255)
b2 = 255;

Thank you very much!