def image_meta_data(path): reader = QImageReader(path) if not reader.canRead(): return ImportImages.ImgDataError(path, reader.error(), reader.errorString()) img_format = reader.format() img_format = bytes(img_format).decode("ascii") size = reader.size() if not size.isValid(): height = width = float("nan") else: height, width = size.height(), size.width() try: st_size = os.stat(path).st_size except OSError: st_size = -1 return ImportImages.ImgData(path, img_format, height, width, st_size)
def image_meta_data(self, path): reader = QImageReader(path) size = os.stat(path).st_size width = reader.size().width() height = reader.size().height() return (size, width, height)