FInd if PNG is 8 or 24?

Is there a way to find out if PNG is type 8 or 24? Ive tried with windows, fireworks and photoshop, but I can't figure it out. thanks

+4
source share
3 answers

Open it in Photoshop and check what is written on the top panel. If it says โ€œindex,โ€ then it was saved as an 8-bit PNG, if it says โ€œRGB / 8,โ€ then your PNG will be 32-bit. Alternatively, you can open the Image / Mode menu, and for 8-bit - "Indexed color", and for 32-bit - "RGB-color."

Another very quick way to say it without opening the file is to see if the image has smooth gradient transparent films. 8-bit pngs do not have transparent gradients - they are either completely opaque or completely transparent (there is nothing between them).

(For those who do not have Photoshop)

How to determine the bit depth for image files in Windows:

*Right click* image file > Properties > Details > Bit depth 

Determine image bit depth in Windows

+6
source

The fastest way is to simply look at bytes 24 and 25 in the PNG file. They contain the bit depth (1, 2, 4, 8 or 16) and the type of color

  • 0: gray
  • 2: rgb,
  • 3: indexed (colormapped),
  • 4: gray + alpha or
  • 6: rgba.

If the bit-bit is 8 and colortype is 3, you have PNG8, and if the bit-rate is 8 and colortype is 2, you have PNG24.

On the * nix platform, the file command will do this for you, for example,

PNG8:

 glenn.rp> file logo.png logo.png: PNG image data, 640 x 480, 8-bit colormap, non-interlaced 

A PNG24:

 glenn.rp> file rose.png rose.png: PNG image data, 70 x 46, 8-bit/color RGB, non-interlaced 
+7
source

Just add the โ€œDepth Bitโ€ column, and it should show the bit depth directly in the detail view in the file explorer.

0
source

All Articles