I want to change some pixels of an image. The image build action is set to "Resource". I'm not possible to get a Bitmap object, so I can make my changes with the for loop below.
Bitmap bmp = new Bitmap("pack://application:,,,/ovl_kommen.png");
//Change Black pixels to color
for (int x = 0; x < bmp.Width; x++)
{
for (int y = 0; y < bmp.Height; y++)
{
if (bmp.GetPixel(x,y) == System.Drawing.Color.Black)
{
bmp.SetPixel(x, y, System.Drawing.Color.Blue);
}
}
}
My next problem is, to view the modified bitmap to an user. I have a WPF image control img_kommen which I want to set the bitmap as source.
img_kommen.Source = bmp