hi i have created a code that allows images from 5 picboxes to merge together.
but i have a problem distinguishing them.
after merging, i would want to have different greyscale values for the images merged into one picbox.
my image is made up of black and white only. thus, the image of the black image(which are actually dots) to have different pixel value. BUT, it must still be a shade of black.
this is the code that i am working on:
public Bitmap mergeImages(Bitmap[] images)
{
Bitmap mergedImg = new Bitmap(images[0].Width, images[0].Height);
for (int h = 0; h < mergedImg.Height; h++)
{
for (int w = 0; w < mergedImg.Width; w++)
{
Color c = images[0].GetPixel(w, h);
if (c.R == 255 && c.G == 255 && c.B == 255)
{
int index = 1;
for (; index < images.Length; index++)
{
if (images[index].GetPixel(w, h) == c)
continue;
else
break;
}
if (index == images.Length)
{
//all the pixel in the same location in all images are all white
mergedImg.SetPixel(w, h, c);
}
else
{
//if not, set the color of the pixel to be black;
Color c1 = Color.FromArgb(0, 0, 0);
mergedImg.SetPixel(w, h, c1);
}
}
else
{
Color c1 = Color.FromArgb(0, 0, 0);
mergedImg.SetPixel(w, h, c1);
}
}
}
return mergedImg;
}
pls help.