public void PreProcess(string filepath, string outputpath, int brightness, int contrast) { System.Drawing.Image image1 = System.Drawing.Image.FromFile(filepath); Bitmap image = (Bitmap)image1; BrightnessCorrection bfilter = new BrightnessCorrection(brightness); bfilter.ApplyInPlace(image); ContrastCorrection cfilter = new ContrastCorrection(contrast); cfilter.ApplyInPlace(image); image.Save(outputpath); }
public void displayMessage() { string filename = @"Testing\card2.tif"; string inputpath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + Path.DirectorySeparatorChar + filename; string outputpath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + Path.DirectorySeparatorChar + @"Testing\newfile1.tif"; System.Drawing.Image image1 = System.Drawing.Image.FromFile(inputpath); Bitmap image = (Bitmap)image1; BrightnessCorrection bfilter = new BrightnessCorrection(40); bfilter.ApplyInPlace(image); ContrastCorrection cfilter = new ContrastCorrection(180); cfilter.ApplyInPlace(image); image.Save(outputpath); }