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

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

 



 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>
.

[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