<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??碼云GVP開源項目 12k star Uniapp+ElementUI 功能強大 支持多語言、二開方便! 廣告
                [TOC] ## 概述 - 讀取圖像最常用的方法是通過構造QImage和QPixmap,或通過調用QImage::load()和QPixmap::load()。 - QImageReader是一個專業讀取圖像的類 ## 示例 ### 設置格式 ``` QImageReader reader; reader.setFormat("png"); // 同reader.setFormat("PNG"); ``` ### 查詢圖片信息讀取 ``` QImageReader reader(":/image.png"); if (reader.supportsOption(QImageIOHandler::Size)) qDebug() << "Size:" << reader.size(); ``` ### 支持格式 ``` QByteArray imageFormat(const QString & fileName) 獲取文件名對應的圖片格式 QByteArray imageFormat(QIODevice * device) 獲取設備對應的圖片格式 QList<QByteArray> supportedImageFormats() 獲取支持的圖片格式 QList<QByteArray> supportedMimeTypes() 獲取支持的Mime類型 ``` ### 獲取描述信息 ``` // 讀取圖像 QImageReader reader; reader.setFileName("AuthorLogo.jpeg"); if (reader.canRead()) { // 讀取圖片 QImage image = reader.read(); // 獲取描述信息 QStringList keys = reader.textKeys(); QString strValue(""); foreach (QString strKey, keys) { strValue = reader.text(strKey).toLocal8Bit(); qDebug() << QString("key : %1 value : %2").arg(strKey).arg(strValue); } } else { // 獲取錯誤信息 QImageReader::ImageReaderError error = reader.error(); QString strError = reader.errorString(); qDebug() << "Last Error : " << strError; } ``` ### 讀取動畫 ``` QImageReader reader; reader.setFileName(":/Images/loading"); if (reader.supportsAnimation()) { // 動畫循環的次數 int nLoopCount = reader.loopCount(); qDebug() << QString("Loop Count : %1").arg(nLoopCount); int nCount = reader.imageCount(); for (int i = 0; i < nCount; ++i) { // 跳到順序號為i的圖像 bool ret = reader.jumpToImage(i); if (reader.canRead()) { // 讀取圖像 QImage image = reader.read(); // 保存圖像 image.save(QString("Loading%1.jpeg").arg(i + 1)); // 下一幀動畫等待的毫秒數 int nDelay = reader.nextImageDelay(); qDebug() << QString("Number %1 Delay : %2").arg(i + 2).arg(nDelay); } else { // 獲取錯誤信息 QImageReader::ImageReaderError error = reader.error(); QString strError = reader.errorString(); qDebug() << "Last Error : " << strError; } } } ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看