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?
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
-
2The relevant
sips
properties aresamplesPerPixel
andbitsPerSample
.– Daniel Beck ♦Feb 2, 2012 at 19:03 -
3By 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.– slhckFeb 2, 2012 at 21:42 -
Ah, so do you just choose 'it needs moderator attention', choose other, and then write in duplicate?– RyanFeb 2, 2012 at 23:19
-
1@Ryan: "It doesn't belong here" -> "Exact Duplicate" -> Paste link. Feb 3, 2012 at 11:56
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.
-
3
-
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".– JonnyJun 25, 2014 at 7:13
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.
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