【发布时间】:2010-02-23 10:46:31
【问题描述】:
我正在使用 Qt 库,创建 QImages。
我可以使用this constructor:
QImage image("example.jpg");
但我遇到了this static function 的问题:
char buffer[sizeOfFile];
ifstream inFile("example.jpg");
inFile.read(buffer, sizeOfFile);
QImage image = QImage::fromData(buffer); // error here
// but there's nothing wrong with the buffer
ofstream outFile("bufferOut.jpg");
outFile.write(buffer, sizeOfFile);
Qt 向控制台输出的地方:
Corrupt JPEG data: 1 extraneous bytes before marker 0xd9
JPEG datastream contains no image
以上内容并不是我所拥有的完全,但这是唯一重要的区别。 (我需要能够从缓冲区读取,因为我正在打开 zip 存档中的图像。)
【问题讨论】: