Figure 1 Addition and subtraction of images — In image addition, you add each pixel in one image to each pixel in another and place the result in a third image. If the sum is greater than the maximum pixel value, you set it to the maximum value. Image subtraction is the same. If the difference is less than 0, then you set it to zero.

Image A  Image B

  0 100   50 150
200 255  250 200

 A + B     A - B

 50 250     0  0
255 255     0 55