How can I find out if a PNG file is 24 bit color or 32 bit color on Mac OS X?

Mac OS X also comes with a utility built into it called sips that could be used to query and manipulate different attributes of image files. As an example, you could use the following command to display all image properties associated with the image:

sips -g all image.png

pngcheck will give a succinct description (and any errors, should they exist):

$ pngcheck *.png
OK: sample24.png (128x128, 24-bit RGB, non-interlaced, 89.7%).
OK: sample32.png (128x128, 32-bit RGB+alpha, non-interlaced, 78.0%).

No errors were detected in 2 of the 2 files tested.

Mac binaries available on supplied link.


ImageMagick's identify utility (command line) will show you all sorts of info about images in a range of formats.

identify -verbose <image file>

If your image is 24 bit you will see:

Channel depth:
  red: 8-bit
  green: 8-bit
  blue: 8-bit

If your PNG image is 32 bit you will see:

Channel depth:
  red: 8-bit
  green: 8-bit
  blue: 8-bit
  alpha: 8-bit

There will be a lot of other information displayed as well.


You can query Spotlight's metadata index using mdls:

mdls -name kMDItemBitsPerSample filename.png
kMDItemBitsPerSample = 32

The results seem a bit odd though. mdls -name kMDItemHasAlphaChannel might be more relevant here.