Re: How to PHP get bit depth of a given PNG image file?
| From: | Mattias Thorslund | Date: | Thu, 16 Jun 2011 06:06:08 +0000 |
| Subject: | Re: How to PHP get bit depth of a given PNG image file? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313555@lists.php.net to get a copy of this message | ||
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