How to tell a PNG8 from a PNG24?
June 7, 2010 10:41 AM   Subscribe

Is there an easy way to identify a PNG-8 image file from a PNG-24 image file?
posted by dugnorth to Computers & Internet (12 answers total)
 
With the naked eye? On a Mac? On a PC? In the command line? In Javascript? With server side technology?
posted by rafter at 10:44 AM on June 7, 2010


Response by poster: I happen to be on a PC and am hoping there is some way to identify one type of PNG from the other using file properties, command line instruction, or a commonly installed utility application.
posted by dugnorth at 10:48 AM on June 7, 2010


Try "identify" from Imagemagick.
posted by Maxwell_Smart at 10:51 AM on June 7, 2010


By "identify" do you mean "differentiate between"? As in, given a .png file, determine whether it's PNG-8 or PNG-24?

If so, the 'file' command in OSX (and I believe other unix systems?) will tell you. I assume there's a windows equivalent if need be.
posted by ook at 10:53 AM on June 7, 2010


Response by poster: @Maxwell_Smart Right, I mean "differentiate between" PNG-8 or PNG-24 if given a PNG file of unknown type.
posted by dugnorth at 11:00 AM on June 7, 2010


I'm ook. He's Maxwell_Smart. And this isn't twitter, we don't generally use @ notation here.

On any unix system just type "file foo.png" to get a description of foo.png's file format (will work on non-PNG file formats as well of course.) I'm less familiar with windows so I'm not sure if there's as simple a way over there -- but you could use Imagemagick as Maxwell_Smart suggests, or if you have a lot of images and aren't averse to a bit of scripting, the Image::Info perl module could do it.

(If the image happens to include alpha transparency, of course, you already have your answer, it's PNG-24.)
posted by ook at 11:23 AM on June 7, 2010


MediaInfo
posted by Biscuit-Head at 11:25 AM on June 7, 2010


Response by poster: Sorry, ook. My bad on both counts.

Thank you for the information. I may have to try Imagemagick. Actually, PNG-8 can have alpha transparency -- a little known fact and the reason behind my little inquiry.
posted by dugnorth at 11:39 AM on June 7, 2010


On Windows 7 it's in the file properties dialog. Probably the same on XP, although I didn't check.
posted by le morte de bea arthur at 11:42 AM on June 7, 2010


Well whaddya know -- you're right... I was under the impression that PNG8 only had single-bit transparency. Good to know, thanks!
posted by ook at 11:46 AM on June 7, 2010


Best answer: Under XP, go to file properties, click the "Summary" tab, and look at the entry for "Bit Depth".
posted by Electric Dragon at 2:21 AM on June 8, 2010


Response by poster: Thanks Electric Dragon! I had tried this prior to posting my question, but for some reason both types were showing a bit depth of 32. I just did a quick test saving out the same image in Photoshop as a PNG8 and PNG24. The bit depth values in the summary tab of the file properties read "8" and "24" respectively -- as expected.
posted by dugnorth at 7:07 AM on June 8, 2010


« Older Are you kidding me Apple?   |   Gotta daaaaaaance! Gotta daaaaance! Newer »
This thread is closed to new comments.