I need to copy the pixels from one image to another, but only the black pixels. I have to separate the black pixels out for sending to a printer using the K Panel on the printer ribbon.
Basically I need to make every pixel in the image that isn’t black transparent or white.
What’s the best way to do this?
The only idea I have is something along the lines of:
var attr = new ImageAttributes();
attr.SetColorKey(minColor, maxColor);
using (Graphics g = Graphics.FromImage(backGround))
{
var destRect = new Rectangle(0, 0, backGround.Width, backGround.Height);
g.DrawImage(kPanelImage, destRect, 0, 0, backGround.Width, backGround.Height, GraphicsUnit.Pixel, attr);
}
1 Answer