Dax Fohl
Dax Fohl

Reputation: 10781

How do you change the color of an Image in WPF?

I have a .png image that's just white-on-transparent, and I'm wondering if there's an easy way to make that green-on-transparent, red-on-transparent, etc so I don't need to make separate .png files for each color.

Upvotes: 4

Views: 23005

Answers (2)

Dax Fohl
Dax Fohl

Reputation: 10781

For a simpler solution that doesn't require pulling in huge libraries and lets you understand what's going on under their hood (and thus gives you greater flexibility), learn how to use WPF Pixel Shaders (google it).

Then you can use something like the multiply shader here: http://rakeshravuri.blogspot.com/2008/08/blending-modes-in-wpf-using.html

Upvotes: 3

Mark Hall
Mark Hall

Reputation: 54532

Take a look at these CodeProject Articles

Image Processing Lab is a simple tool for image processing, which includes different filters and tools to analyze images available in the AForge.NET framework.

You could also take a look at the FormatConvertedBitmap, ColorConvertedBitmap or WritableBitmap Class's

Upvotes: 3

Related Questions