我的開發平台是 win7
工具是QT Creator
版本是Qt Core 5.15.2
我採用內建的 QZipReader (#include "private/qzipreader_p.h")
來讀取zip壓縮檔內的單一檔案,然後顯示
當讀取壓縮檔內的bmp, png, jpg時
我用QImage來讀取圖片可成功讀取
mPath = "F:/image/myzip.zip";
path = "myzip.zip/01.jpg";
mZipReader = new QZipReader(mPath);
QByteArray data{mZipReader->fileData(path)};
bool isSuccessed = image.loadFromData(data,"JPG");
但是如果要讀取的檔案是GIF檔
則無論用QImageReader 或是 QMovie 都無法成功讀取
mPath = "F:/image/myzip.zip";
path = "myzip.zip/1445806472.gif";
mZipReader = new QZipReader(mPath);
QByteArray data{mZipReader->fileData(path)};
QMovie *movie = new QMovie(data, "GIF");
qDebug() << movie->isValid(); //false
qDebug() << movie->lastErrorString(); //"File not found"
qDebug() << movie->fileName(); // "GIF89a\u0016\u0002B\u0001?"
想請問除了換用其他的lib之外,還有其他讀取壓縮檔內gif可行的辦法嗎?
感謝閱讀