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

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


« previous php.general (#313557) next »