public static PngFile ReadFile(string fileName) { PngFile pngFile = new PngFile(); Bitmap bitmap = (Bitmap)Bitmap.FromFile(fileName); if (bitmap.PixelFormat != PixelFormat.Format32bppArgb) throw new NotSupportedException("PNG must be 32 bit RGBA format"); pngFile.Width = bitmap.Width; pngFile.Height = bitmap.Height; pngFile.RgbaData = GetRgbaData(bitmap); return pngFile; }
public static PngFile ReadFile(string fileName) { PngFile pngFile = new PngFile(); Bitmap bitmap = (Bitmap)Bitmap.FromFile(fileName); if (bitmap.PixelFormat != PixelFormat.Format32bppArgb) { throw new NotSupportedException("PNG must be 32 bit RGBA format"); } pngFile.Width = bitmap.Width; pngFile.Height = bitmap.Height; pngFile.RgbaData = GetRgbaData(bitmap); return(pngFile); }