Color To Gray - CSharp System.Drawing

CSharp examples for System.Drawing:Color

Description

Color To Gray

Demo Code


using System.Text;
using System.Drawing;
using System.Collections.Generic;
using System;//from   w  w  w .j a  va  2 s  .  c  o m

public class Main{
        public static int ToGray(this Color c)
        {
            return (int) (0.299* c.R + 0.587*c.G + 0.114*c.B) ;
        }
}

Related Tutorials