Subject: Re: Creating a Sepia Tone Filter
i have simple sepia filter, i was quite happy with it... you can also
directly control sepia tone and amount of grey ...
int r = (p_data[i] & 0xff0000) >> 16;
int g = (p_data[i] & 0xff00) >> 8;
int b = p_data[i] & 0xff;
/// get rgb values
float _y = r * .299f + g * .587f + b * .114f;
float _i = .18f * 0xff;
float _q = -.001f * 0xff;
// convert to yiq, i = .2f (sepia tone), q = near 0 (amount of grey)
r = clamp(/*1.0f **/ _y + .956f * _i + .621f * _q, 0, 0xff);
g = clamp(/*1.0f **/ _y - .272f * _i - .647f * _q, 0, 0xff);
b = clamp(/*1.0f **/ _y - 1.105f * _i + 1.702f * _q, 0, 0xff);
// back to rgb
p_data[i] = 0xff000000 | r | (g << 8) | (b << 16);
// store RGB values
> I have been working on trying to creat a sepia tone filter. I have used
> many suggestions, but none have worked unfortunetly.
> //New Red = R*.393 + G*.769 + B*.189
> //New Green = R*.349 + G*.686 + B*.168
> //New Blue = R*.272 + G*.534 + B*.131
> //gr = (0.30 red) + (0.59 green) + (0.11 blue)
> //r2 = gr * 0.44; add tint
> //g2 = gr * 0.27;
> //b2 = gr * 0.15;
> none of the two worked. If anyone had any feed back that would be great.
View All Messages in comp.graphics.algorithms
Creating a Sepia Tone Filter =>
Copyright © 2006 WatermarkFactory.com. All Rights Reserved.