Depth (not quantum depth) of image using identify

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Pravin

Re: Depth (not quantum depth) of image using identify

Post by Pravin »

Thanks a lot for your help.

I have to define switch case to get depth as per the "PseudoClass" and "PattetteMatte". I am not sure what exactly i should write in that code.
I am providing C#.net code for to get depth of image just for reference. .net bitmap class support less formats. I can not use that code for other file formats.

Code: Select all

 Image image = Image.FromFile(FileName); // Image is .net class
 switch (image.PixelFormat)
    {
         case PixelFormat.Format16bppGrayScale: // Pixel format is enumaration to map the image depth 
         case PixelFormat.Format16bppRgb555:
         case PixelFormat.Format16bppRgb565:
         case PixelFormat.Format16bppArgb1555:
               OutputFileAttribs.Depth = 16;
          break;
          case PixelFormat.Format24bppRgb:
              OutputFileAttribs.Depth = 24;
          break;
          case PixelFormat.Format32bppArgb:
          case PixelFormat.Format32bppPArgb:
          case PixelFormat.Format32bppRgb:
               OutputFileAttribs.Depth = 32;
          break;
          case PixelFormat.Format48bppRgb:
               OutputFileAttribs.Depth = 48;
          break;
          case PixelFormat.Format64bppArgb:
               OutputFileAttribs.Depth = 64;
          break;
          default:
               OutputFileAttribs.Depth = 24;
           break;
      }
I need specific information to define enumeration for depth returned by identify.exe.
Thanks a lot.
Post Reply