Image Addition in C# by asif

Basic Working Mechanism

In its most straightforward implementation, this operator takes as input two identically sized images and produces as output a third image of the same size as the first two, in which the intensity of each pixel is the sum of the values of the corresponding pixels from each of the two input images. More sophisticated versions allow more than two images to be combined with a single operation.

A common variant of the operator simply allows a specified constant to be added to every pixel.

How Nature Produces Colors:

in fact, the basic colors present in the nature are three Red, Green and blue. The rest of the colors are the combination of these basic colors. The following figures illustrate the basic mechanism performed by the addition of these colors.


we can see here that how the addition of colors are changing them to some other colors. That is the basic reason due to which we say that we can make 224 =16777216 different colors.

General Working

The addition of two images is performed straightforwardly in a single pass. The output pixel values are given by:

Q(i,j)=P1(i,j)+ P2(i,j)

Or if it is simply desired to add a constant value C to a single image then:

Q(i,j)=P(i,j)+ C

If the pixel values in the input images are actually vectors rather than scalar values then the individual components (e.g. red, blue and green components) are simply added separately to produce the output value.

If the image format being used only supports, say 8-bit integer pixel values, then it is very easy for the result of the addition to be greater than the maximum allowed pixel value. The effect of this depends upon the particular implementation. The overflowing pixel values might just be set to the maximum allowed value, an effect known as saturation. Alternatively the pixel values might wrap around from zero again. If the image format supports pixel values with a much larger range, e.g. 32-bit integers or floating point numbers, then this problem does not occur so much.

Guidelines for Use

To understand the working of the Image Addition, take the example of the following images:


the Resultant Image Obtained by the addition of the above images is as:

Sample Project

Please Review other articles based on Logical Operators to get the better understanding of the project. The application seems to be in this GUI.

The project is a part of the series of the image processing articles written just for the prosperity and help for the students searching for Image Processing free stuff.


Project Files: