Search code examples
c#gdi+getpixel

C# alternative to setpixel


I have read through several articles which are alternatives to using setpixel/getpixel but I am not seeing how they relate to my issue.

I have a multicoloured image which (depending on dynamic values taken from DB) changes the color of each pixel color group to a new color.

Lets say I want all pixels with Argb value of -989556 changed to -16 & all pixels with Argb value of -1331 changed to -5383962. I am currently looking at every pixel in the Bitmap and checking their value, if they match then they are changed using setpixel.

I am sure there must be a better way but I am being too dim to see it!


Solution

  • Take a look at ImageAttributes.SetRemapTable

    Another example.