<<< Home << Web < Arithmetic Top Bottom < Prev Next >

Image Arithmetic
Add


Addition

When you use a divisor of 1 and a bias of 0, adding two colors simply adds the values of the red, green and blue components as three separate additions. For example, if you add (15,30,90) to (90,20,10), you get (15+90,30+20,90+10), or (105,50,100).

(15,30,90) + (90,20,10) = (105,50,100)

Clipping

Since each of the individual values ranges from 0 through 255, each result can range from 0 through 510. You have two choices in how you handle results larger than 255:

You'll get quite different results depending on whether you choose to clip:

Clipped: (160,32,144) + (208,80,192) = (255,112,255)
 
Unclipped: (160,32,144) + (208,80,192) = (112,112,80)

Adding Black

The color black has RGB values of (0,0,0). Therefore, adding black to any color does not change that color.

(0,0,0) + (90,112,32) = (90,112,32)

Adding White

The color white has RGB values of (255,255,255). What happens when you add white to another color depending on whether you're using clipping:

Unclipped: (255,255,255) + (208,80,192) = (207,79,191)
 
Unclipped: (255,255,255) + (208,0,192) = (207,255,191)
 
Unclipped: (255,255,255) + (0,1,1) = (255,0,0)

Here are a few examples of addition:

Addition - Divisor=1, Bias=0
1st color 2nd color Result
(unclipped)
Result
(clipped)
0,0,0 0,255,0 0,255,0 0,255,0
255,0,0 0,255,0 255,255,0 255,255,0
255,0,0 0,0,255 255,0,255 255,0,255
0,255,0 0,0,255 0,255,255 0,255,255
255,255,255 51,102,153 50,101,152 255,255,255
255,255,255 0,37,104 255,36,103 255,255,255
85,152,53 208,85,2 37,237,55 255,237,55

<<< Home << Web < Arithmetic Top Bottom < Prev Next >