Search code examples
c#.netimagegdi+colormatrix

Rotate Hue using ImageAttributes in C#


How can I rotate the hue of an image using GDI+'s ImageAttributes (and presumably ColorMatrix)?

Note that I want to rotate the hue, not tint the image.

EDIT: By rotating the hue, I mean that each color in the image should be shifted to a different color, as opposed to making the entire image a shade of one color.

For example,

Original:http://www.codeguru.com/img/legacy/gdi/Tinter03.jpg

Rotated: http://www.codeguru.com/img/legacy/gdi/Tinter15.jpg or http://www.codeguru.com/img/legacy/gdi/Tinter17.jpg


Solution

  • I ended up porting QColorMatrix to C# and using its RotateHue method.