Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WPF Image, changing color of pixels

I have a problem. I need to fill (or repaint) some pixels at image, stored in Image control. This is a png image. I mean, that all black pixels should be filled with, for example, red color. How can I do this? I thought I can access directly to pixels and using XOR change special bits, but I don't know how to do this. Or maybe there is an easier way?

like image 918
Ivan Avatar asked Oct 25 '11 20:10

Ivan


1 Answers

The GetPixel and SetPixel methods should work for what you need.

This answer has a code sample that you should be able to adopt for your use.

like image 169
Stewbob Avatar answered Oct 20 '22 01:10

Stewbob