How to PHP get bit depth of a given PNG image file?
| From: | Nam Gi VU | Date: | Thu, 16 Jun 2011 05:11:14 +0000 |
| Subject: | How to PHP get bit depth of a given PNG image file? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-313554@lists.php.net to get a copy of this message | ||
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.
Please help.
class Utils {
//Ham de lay bits cua image
public static function getBits($image) {
$info = getImageSize($image);
return $info['bits'];
}
}
Hope to hear from all of you!
Regards,
Nam.
p.s I also post this issue on stackoverflow.com which is
here<http://stackoverflow.com/questions/6355692/how-to-php-get-bit-depth-of-a-given-png-image-file>
.