public function countGlobalColors()
    {
        $byte = substr($this->logicalScreenDescriptor, 4, 1);

        if (strlen($byte) == 1) {
            $byte = unpack('C', $byte)[1];
            $bit = $byte & bindec('00000111');
        }
        
        // length of the global color table is 2^(N+1)        
        return isset($bit) ? pow(2, $bit + 1) : 0;
    }