Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Create a Duotone Interpolation Color in GDI+ (.NET)?

I have two colors that I need to linearly interpolate to create a duotone color based of another color's luminance value.

Dim clr1 = Color.Black
Dim clr2 = Color.FromArgb(224, 255, 165)
Dim lum = Color.FromArgb(226, 189, 136).GetBrightness
'lum = 0.71

I know the result of this should be R=171, G=192, B=125, but I can't figure out how to do this. I've searched through SO quite a bit and all over Google, but have not discovered a way to produce this result. Can anyone help?

like image 290
Todd Main Avatar asked Nov 30 '25 04:11

Todd Main


1 Answers

Figured it out - my lum value should have been using relative luminance instead.

like image 119
Todd Main Avatar answered Dec 02 '25 17:12

Todd Main



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!