Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
1  
Questions were merged, that's why there are duplicate answers. –  Daniel Beck Feb 3 '12 at 11:59
add comment

5 Answers

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
share|improve this answer
1  
The relevant sips properties are samplesPerPixel and bitsPerSample. –  Daniel Beck Feb 2 '12 at 19:03
2  
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 '12 at 21:42
    
Ah, so do you just choose 'it needs moderator attention', choose other, and then write in duplicate? –  Ryan Feb 2 '12 at 23:19
1  
@Ryan: "It doesn't belong here" -> "Exact Duplicate" -> Paste link. –  Tom Wijsman Feb 3 '12 at 11:56
add comment

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.

share|improve this answer
2  
If you are on a Mac and have homebrew, you can install it with: brew install pngcheck –  gdelfino Mar 28 '12 at 11:46
add comment

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.

share|improve this answer
add comment

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
share|improve this answer
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.