Re: How to PHP get bit depth of a given PNG image file?
| From: | Nam Gi VU | Date: | Thu, 16 Jun 2011 06:11:11 +0000 |
| Subject: | Re: How to PHP get bit depth of a given PNG image file? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313556@lists.php.net to get a copy of this message | ||
Thank you Mattias,
I'll look at
channels again.
Regards,
Nam
On Thu, Jun 16, 2011 at 1:06 PM, Mattias Thorslund <mattias@thorslund.us>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
>
>