當前位置: 首頁>>代碼示例>>Python>>正文


Python Qt.QImageReader類代碼示例

本文整理匯總了Python中PyQt5.Qt.QImageReader的典型用法代碼示例。如果您正苦於以下問題:Python QImageReader類的具體用法?Python QImageReader怎麽用?Python QImageReader使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了QImageReader類的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: image_and_format_from_data

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
開發者ID:timpalpant,項目名稱:calibre,代碼行數:7,代碼來源:img.py

示例2: image_and_format_from_data

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
開發者ID:x007007007,項目名稱:calibre,代碼行數:8,代碼來源:img.py

示例3: verify_theme

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)
開發者ID:davidfor,項目名稱:calibre,代碼行數:9,代碼來源:icon_theme.py

示例4: test_qt

    def test_qt(self):
        from PyQt5.Qt import QImageReader, QNetworkAccessManager, QFontDatabase
        from calibre.utils.img import image_from_data, image_to_data, test
        # Ensure that images can be read before QApplication is constructed.
        # Note that this requires QCoreApplication.libraryPaths() to return the
        # path to the Qt plugins which it always does in the frozen build,
        # because the QT_PLUGIN_PATH env var is set. On non-frozen builds,
        # it should just work because the hard-coded paths of the Qt
        # installation should work. If they do not, then it is a distro
        # problem.
        fmts = set(map(unicode, QImageReader.supportedImageFormats()))
        testf = {'jpg', 'png', 'svg', 'ico', 'gif'}
        self.assertEqual(testf.intersection(fmts), testf, "Qt doesn't seem to be able to load some of its image plugins. Available plugins: %s" % fmts)
        data = I('blank.png', allow_user_override=False, data=True)
        img = image_from_data(data)
        image_from_data(P('catalog/mastheadImage.gif', allow_user_override=False, data=True))
        for fmt in 'png bmp jpeg'.split():
            d = image_to_data(img, fmt=fmt)
            image_from_data(d)
        # Run the imaging tests
        test()

        from calibre.gui2 import Application
        os.environ.pop('DISPLAY', None)
        app = Application([], headless=islinux)
        self.assertGreaterEqual(len(QFontDatabase().families()), 5, 'The QPA headless plugin is not able to locate enough system fonts via fontconfig')
        na = QNetworkAccessManager()
        self.assertTrue(hasattr(na, 'sslErrors'), 'Qt not compiled with openssl')
        from PyQt5.QtWebKitWidgets import QWebView
        QWebView()
        del QWebView
        del na
        del app
開發者ID:NathanaelA,項目名稱:calibre,代碼行數:33,代碼來源:test_build.py

示例5: test_qt

def test_qt():
    from calibre.gui2 import Application
    from PyQt5.Qt import (QImageReader, QNetworkAccessManager, QFontDatabase)
    from PyQt5.QtWebKitWidgets import QWebView
    os.environ.pop('DISPLAY', None)
    app = Application([], headless=islinux)
    if len(QFontDatabase().families()) < 5:
        raise RuntimeError('The QPA headless plugin is not able to locate enough system fonts via fontconfig')
    fmts = set(map(unicode, QImageReader.supportedImageFormats()))
    testf = set(['jpg', 'png', 'mng', 'svg', 'ico', 'gif'])
    if testf.intersection(fmts) != testf:
        raise RuntimeError(
            "Qt doesn't seem to be able to load its image plugins")
    QWebView()
    del QWebView
    na = QNetworkAccessManager()
    if not hasattr(na, 'sslErrors'):
        raise RuntimeError('Qt not compiled with openssl')
    del na
    del app
    print ('Qt OK!')
開發者ID:Aliminator666,項目名稱:calibre,代碼行數:21,代碼來源:test_build.py

示例6: image_extensions

def image_extensions():
    if not hasattr(image_extensions, 'ans'):
        image_extensions.ans = [as_unicode_polyglot(x) for x in QImageReader.supportedImageFormats()]
    return image_extensions.ans
開發者ID:j-howell,項目名稱:calibre,代碼行數:4,代碼來源:dnd.py

示例7: image_extensions

def image_extensions():
    if not hasattr(image_extensions, 'ans'):
        image_extensions.ans = [bytes(x).decode('utf-8') for x in QImageReader.supportedImageFormats()]
    return image_extensions.ans
開發者ID:MarioJC,項目名稱:calibre,代碼行數:4,代碼來源:dnd.py


注:本文中的PyQt5.Qt.QImageReader類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。