CodePlexProject Hosting for Open Source Software
Home Linq Image Processing sample
static void Main(string[] args) { const float rScale = 0.3f; const float gScale = 0.59f; const float bScale = 0.11f; const string filename = "bigImage"; var original = Image.FromFile(string.Format("{0}.jpg", filename)) as Bitmap; var grayscale = new Bitmap(original.Width, original.Height, original.PixelFormat); grayscale.SetData(from pixel in original.GetData<Format24BppRgb>() let grayValue = (byte)(pixel.R * rScale + pixel.G * gScale + pixel.B * bScale) select new Format24BppRgb(grayValue)); grayscale.Save(string.Format("{0}-grayscale.jpg", filename)); }
Last edited Feb 15, 2012 at 6:52 PM by ananth, version 3
There is no recommended release for this project.