Get Color Luminance - CSharp System.Drawing

CSharp examples for System.Drawing:Color Brightness

Description

Get Color Luminance

Demo Code


using System.Drawing.Imaging;
using System.Drawing;
using System.Threading.Tasks;
using System.Text;
using System.Runtime.InteropServices;
using System.Linq;
using System.Collections.Generic;
using System;/*from  www .j  av a 2  s. c  om*/

public class Main{
        public static int GetLuminance (this Color color)
        {
            return (int) (color.R * 0.2126 + color.G * 0.7152 + color.B * 0.0722);
        }
}

Related Tutorials