/// <summary> /// Export colored bitmap to any normal image format. /// </summary> public void ExportAs(string filename) { try { string extension = Path.GetExtension(filename).ToLower(); ImageFormat imageFormat = ImageFormat.Bmp; switch (extension) { case ".bmp": imageFormat = ImageFormat.Bmp; break; case ".gif": imageFormat = ImageFormat.Gif; break; case ".jpg": case ".jpeg": imageFormat = ImageFormat.Jpeg; break; case ".png": imageFormat = ImageFormat.Png; break; case ".tiff": imageFormat = ImageFormat.Tiff; break; default: throw new Exception("File extension not supported: " + extension); } CleanGetCopy.Save(filename, imageFormat); } catch (Exception exception) { if (CleanGetCopy.Width > 65500 || CleanGetCopy.Height > 65500) { throw new Exception("Failed to save file. Image is wider or taller than maximum GDI+ can handle: 65,500 pixels.", exception); } throw exception; } }
public Color GetPixel(Point point) { return(CleanGetCopy.GetPixel(point.X, point.Y)); }