Kamil Zadora Kamil Zadora - 1 month ago 10
C# Question

How to manipulate images at the pixel level in C#

How do I manipulate images at the pixel level in C#?

I need to be able to read/modify each bitmap pixel RGB values separately.

A code sample would be appreciated.

Answer

If you want speed, then LockBits. See here for a good walkthrough by Bob Powell. If you just want to edit a few, then GetPixel/SetPixel should do what you want.

Comments