def image_and_format_from_data(data): ba = QByteArray(data) buf = QBuffer(ba) buf.open(QBuffer.ReadOnly) r = QImageReader(buf) fmt = bytes(r.format()).decode("utf-8") return r.read(), fmt
def image_and_format_from_data(data): ' Create an image object from the specified data which should be a bytsestring and also return the format of the image ' ba = QByteArray(data) buf = QBuffer(ba) buf.open(QBuffer.ReadOnly) r = QImageReader(buf) fmt = bytes(r.format()).decode('utf-8') return r.read(), fmt
def verify_theme(report): must_use_qt() report.bad = bad = {} for name, path in iteritems(report.name_map): reader = QImageReader(os.path.join(report.path, path)) img = reader.read() if img.isNull(): bad[name] = reader.errorString() return bool(bad)
def verify_theme(report): must_use_qt() report.bad = bad = {} for name, path in report.name_map.iteritems(): reader = QImageReader(os.path.join(report.path, path)) img = reader.read() if img.isNull(): bad[name] = reader.errorString() return bool(bad)