Code: Select all
outputRed = (inputRed * .393) + (inputGreen *.769) + (inputBlue * .189)
outputGreen = (inputRed * .349) + (inputGreen *.686) + (inputBlue * .168)
outputBlue = (inputRed * .272) + (inputGreen *.534) + (inputBlue * .131)
Moderator: Moderators
Code: Select all
outputRed = (inputRed * .393) + (inputGreen *.769) + (inputBlue * .189)
outputGreen = (inputRed * .349) + (inputGreen *.686) + (inputBlue * .168)
outputBlue = (inputRed * .272) + (inputGreen *.534) + (inputBlue * .131)
Code: Select all
>> [.393 .769 .189; .349 .686 .168; .272 .534 .131]^-1
ans =
1.2727e+03 1.5455e+03 -3.8182e+03
-1.9008e+02 6.1983e+02 -5.2066e+02
-1.8678e+03 -5.7355e+03 1.0058e+04
What an odd statement. Is Microsoft was some kind of sepia authority now?These specific values are the values for sepia tone that are recommended by Microsoft.
Code: Select all
newValue_R = (brightness * $70) >> 7
newValue_G = (brightness * $42) >> 7
newValue_B = (brightness * $14) >> 7
But that's not "converting to grayscale firstly". How am I supposed to do with RGB values?lidnariq wrote:Which looks more like an amber CRT than actual sepiatone, because sepiatone (a silver sulfide gelatin print) isn't a single line in RGB space. It's formed by producing a thicker and thicker layer of Ag₂S, which for a given amount W of material, blocks X% of blue light, Y% of green light, and Z% of red light. So it's almost a straight line in HSL (but not in HSV)
Code: Select all
int Y = (p->red * .3) + (p->green * .6) + (p->blue *.1);
int Gnew = Y;
int Bnew = (Y * Y / 255 + Y) / 2;
int Rnew = 3 * 255 - (Gnew + Bnew);
p->red = Rnew; p->green = Gnew; p->blue = Bnew;
if(p->red > 255) p->red = 255;
if(p->green > 255) p->green = 255;
if(p->blue > 255) p->blue = 255;
Sorry for the request, but mind you to write a C code for it? Mine's generating grayscale only.rainwarrior wrote:Gamma means a power/exponent operation. In this case I think the suggestion was:
R ^ (1 / 2.2)
G ^ (1 / 1.1)
B ^ (1 / 0.55)
Code: Select all
float r; // input colours in the range 0-1
#include <math.h>
r = pow(r, 1.0 / 2.2); // R ^ (1 / 2.2)
// output r is still in the range 0-1