this thread should provide examples of code for the color mod.ape.
Per channel color reduction
init:
colred=[any value between 1 and 256]
colgreen=[any value between 1 and 256]
colblue=[any value between 1 and 256]
channel:
red=floor(red*colred)/(colred-1);
green=floor(green*colgreen)/(colgreen-1);
blue=floor(blue*colblue)/(colblue-1);
Color mod code snippets
10 posts
tip for many simple conversions in the CMF:
define red channel, and then assign 'red' to the other two channels.
a multiplier x3 can be just:
color edge [a greyscale image needed for a 1-bit/b&w color result]:
define red channel, and then assign 'red' to the other two channels.
a multiplier x3 can be just:
and it will be the same likered = red*3;
blue = red;
green = red;
since the r,b and g values are equal each time [256 times that is] the level box is evaluated.red = red*3;
blue = blue*3;
green = green*3;
color edge [a greyscale image needed for a 1-bit/b&w color result]:
brighten image without clipping colors [middle tones brightness]:red = above(red,.5);
blue = red;
green = red;
red = pow(red,x); // 0<x<1, the smaller the brighter
blue = red;
green = red;
Intensify colors by multiplying a channel with 1+value and then subtract that same value.
ie.
value=0.5 ;
red=red*(1+value)-value ;
And so on for the rest of the channels. You can also use it in reverse (make the value a - one to get less intense colors all the way up where everything is just white)
ie.
value=0.5 ;
red=red*(1+value)-value ;
And so on for the rest of the channels. You can also use it in reverse (make the value a - one to get less intense colors all the way up where everything is just white)
I'm going to be pedantic and point out some of the correct terminology because people are using the wrong words:
Brightness is an additive equation
e.g. red = red + 0.1
blue = blue + (-0.5)
Contrast is a multiplicative equation
e.g. red = red * 1.1
blue = blue * 0.9
Gamma is an exponential equation
e.g. red = pow(red,3)
blue = pow(blue,0.9)
Intensity is an energy measurement (energy flux/time) but it doesnt mean very much on computers. The closest actual image processing term is 'luminence' (as in Hue, Saturation and) Tuggs example is a contrast adjustment followed by a brightness reduction
Brightness is an additive equation
e.g. red = red + 0.1
blue = blue + (-0.5)
Contrast is a multiplicative equation
e.g. red = red * 1.1
blue = blue * 0.9
Gamma is an exponential equation
e.g. red = pow(red,3)
blue = pow(blue,0.9)
Intensity is an energy measurement (energy flux/time) but it doesnt mean very much on computers. The closest actual image processing term is 'luminence' (as in Hue, Saturation and) Tuggs example is a contrast adjustment followed by a brightness reduction
And it makes the colors more intense.
I think it makes them more rubbery
gradiation curve
this allows you to increase the contrast in middle tone or dark and bright areas.
linear curve:

curve with increased midtone contrast:

init or frame: midcon=[-1,1] //0=>no changes
//below 0=> low contrast in midtones
//above 0=> high contrast in midtones
someval=pow(8,-midcon);
channel: red=0.5*pow(abs(2*red-1),someval)*sign(2*red-1)+0.5;
this allows you to increase the contrast in middle tone or dark and bright areas.
linear curve:

curve with increased midtone contrast:

init or frame: midcon=[-1,1] //0=>no changes
//below 0=> low contrast in midtones
//above 0=> high contrast in midtones
someval=pow(8,-midcon);
channel: red=0.5*pow(abs(2*red-1),someval)*sign(2*red-1)+0.5;
Time independent fadeout effect. The line on frame, "f=pow(.8,30*dt);" sets the speed and curve of the fadeout, tweak the values of .8 between 0..1 and the 30 between 0..+inf to see how to use it...
init:
lasttime=gettime(0);
frame:
t=gettime(0);dt=t-lasttime;lasttime=t;
f=pow(.8,30*dt);
level:
red=red*f;
blue=red;
green=red;
init:
lasttime=gettime(0);
frame:
t=gettime(0);dt=t-lasttime;lasttime=t;
f=pow(.8,30*dt);
level:
red=red*f;
blue=red;
green=red;
here is a example of my midtone contrast color mod
custom chrome effect triangle wave like
init: nc=[1-256 number of cycles]
level: someval=floor(red*nc);
red=if(someval%2,1-(red*nc-someval),(red*nc-someval));
custom chrome effect sine wave like
init: nc=[1-256 number of cycles]
channel: red=0.5-0.5*cos(red*$pi*nc);
init: nc=[1-256 number of cycles]
level: someval=floor(red*nc);
red=if(someval%2,1-(red*nc-someval),(red*nc-someval));
custom chrome effect sine wave like
init: nc=[1-256 number of cycles]
channel: red=0.5-0.5*cos(red*$pi*nc);