CSharp examples for System.Drawing:Color Brightness
Get Color Brightness
using System.Windows.Media; using System.Threading.Tasks; using System.Text; using System.Linq; using System.Collections.Generic; using System;// w w w .ja v a2 s .c o m public class Main{ public static float GetBrightness(this Color c) { byte minval = Math.Min(c.R, Math.Min(c.G, c.B)); byte maxval = Math.Max(c.R, Math.Max(c.G, c.B)); return (float)(maxval + minval) / 510; } }