Re: How to PHP get bit depth of a given PNG image file?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I think the documentation is a bit unclear about the fact that "colors" and "channels" are the same thing here. The line about bits should probably say "bits is the number of bits for each *channel*".

Mattias

On 06/15/2011 11:11 PM, Nam Gi VU wrote:
Thank you Mattias,

I'll look at `channels` again.

Regards,
Nam



On Thu, Jun 16, 2011 at 1:06 PM, Mattias Thorslund<mattias@xxxxxxxxxxxx>wrote:

On 06/15/2011 10:11 PM, Nam Gi VU wrote:

  Hi everyone,

In PHP code, given an .png image path, I need to detect the bit-depth of
that image. How can I do that?

I've tried to use getImageSize() and read the bits as below sample code
but
it always returns '8' for 24-bits/32-bits image.

Reading the manual, it says:

"
channels will be 3 for RGB pictures and 4 for CMYK pictures.
bits is the number of bits for each color.
"

So, to get the total bit depth, I think you need to multiply by the number
of colors, which is in the "channels" element.

Cheers,

Mattias


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux