tags:

views:

40

answers:

0

I'm trying to get information about a PNG file but I've yet to discover a comprehensive site to help me.

These are some of the semi useful code snippets I have:

Bitmap bmp = new Bitmap(pngFileName);
BitmapData bd = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), ImageLockMode.ReadOnly,PixelFormat.Format48bppRgb);

and

Stream imageStreamSource = new FileStream(pngFileName, FileMode.Open, FileAccess.Read, FileShare.Read);
var decoder = new PngBitmapDecoder(imageStreamSource, BitmapCreateOptions.PreservePixelFormat, BitmapCacheOption.Default);

BitmapSource bitmapSource = decoder.Frames[0];

With these I've been able to to get the image height and width. However I still need to discover the following information:

  • Is it RLE encoded?
  • Is it in native video format?
  • Is it rotated?
  • Does it use a grayscale palette?
  • Does it have a transparency?
  • Is it RGB or BGR?

I'd really appreciate some pointers on how to acheive this or links to good articles dealing with this. We're working with .NET 4.0