In .NET one way to check the bitdepth of a Bitmap image is using the Bitmap class like so:
switch (bitmap.PixelFormat) {
case System.Drawing.Imaging.PixelFormat.Format1bppIndexed: return 1;
case System.Drawing.Imaging.PixelFormat.Format4bppIndexed: return 4;
case System.Drawing.Imaging.PixelFormat.Format8bppIndexed: return 8;
case System.Drawing.Imaging.PixelFormat.Format16bppArgb1555:
case System.Drawing.Imaging.PixelFormat.Format16bppGrayScale:
case System.Drawing.Imaging.PixelFormat.Format16bppRgb555:
case System.Drawing.Imaging.PixelFormat.Format16bppRgb565: return 16;
case System.Drawing.Imaging.PixelFormat.Format24bppRgb: return 24;
case System.Drawing.Imaging.PixelFormat.Format32bppArgb:
case System.Drawing.Imaging.PixelFormat.Format32bppPArgb:
case System.Drawing.Imaging.PixelFormat.Format32bppRgb: return 32;
case System.Drawing.Imaging.PixelFormat.Format48bppRgb: return 48;
case System.Drawing.Imaging.PixelFormat.Format64bppArgb:
case System.Drawing.Imaging.PixelFormat.Format64bppPArgb: return 64;
}
I am trying to write an equivalent function targeting Mono for Android (xamarin project) that returns me the bitdepth of a Bitmap file but the Bitmap class in the Adroid.Graphics namespace, is a lot less helpful - or perhaps just too unfamilar to me. Can anyone help?