17

I have PNG image files on Mac OS X. How can I find out if an image is 24 bit color or 32 bit color?

1
  • 1
    Questions were merged, that's why there are duplicate answers.
    – Daniel Beck
    Feb 3, 2012 at 11:59

5 Answers 5

24

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
4
  • 2
    The relevant sips properties are samplesPerPixel and bitsPerSample.
    – Daniel Beck
    Feb 2, 2012 at 19:03
  • 3
    By the way, if you can use another answer by 1:1 copying it, the question's most probably a duplicate. In this case, please don't answer it, but flag it for moderator attention to have it closed as a dupe instead.
    – slhck
    Feb 2, 2012 at 21:42
  • Ah, so do you just choose 'it needs moderator attention', choose other, and then write in duplicate?
    – Ryan
    Feb 2, 2012 at 23:19
  • 1
    @Ryan: "It doesn't belong here" -> "Exact Duplicate" -> Paste link. Feb 3, 2012 at 11:56
14

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.

2
  • 3
    If you are on a Mac and have homebrew, you can install it with: brew install pngcheck
    – gdelfino
    Mar 28, 2012 at 11:46
  • Good answer - the sips suggestion didn't work for me - Both png-8 and png-24 files are reported as 8 bit sRGB. Another working answer is also file *.png - no extra installs required. png-8 will show as "colormap" whereas png-24 shows as "color RGB".
    – Jonny
    Jun 25, 2014 at 7:13
8

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.

4

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.

3

In addition to what has been suggested, Mac OS X 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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .