parameters: (self, key)
docstring: :param key: The full path to the analysed image.
          :return: tuple (image size, number of channels).
docstring_summary: :param key: The full path to the analysed image.
          :return: tuple (image size, number of channels).
docstring_tokens: : param key : The full path to the analysed image . : return : tuple ( image size number of channels ) .
function: def get_image_info(self, key):
          """
          :param key: The full path to the analysed image.
          :return: tuple (image size, number of channels).
          """
          try:
              with open(key, "rb") as fin:
                  img = Image.open(fin)
                  return tuple(reversed(img.size)), MODE_COLOR_MAP[img.mode]
          except Exception as e:
              self.warning("Failed to read %s with PIL: %s", key, e)
              # Unable to read the image with PIL. Fall back to slow OpenCV
              # method which reads the whole image.
              img = cv2.imread(key, cv2.IMREAD_UNCHANGED)
              if img is None:
                  raise error.BadFormatError("Unable to read %s" % key)
              return img.shape[:2], "BGR"
function_tokens: def get_image_info ( self , key ) : try : with open ( key , "rb" ) as fin : img = Image . open ( fin ) return tuple ( reversed ( img . size ) ) , MODE_COLOR_MAP [ img . mode ] except Exception as e : self . warning ( "Failed to read %s with PIL: %s" , key , e ) # Unable to read the image with PIL. Fall back to slow OpenCV # method which reads the whole image. img = cv2 . imread ( key , cv2 . IMREAD_UNCHANGED ) if img is None : raise error . BadFormatError ( "Unable to read %s" % key ) return img . shape [ : 2 ] , "BGR"