I'm having some difficulties saving an image as jpg.
When I run the following code in an application, everything works fine. However, the exact same code in a dll-function that gets called by an application, fails.
QImage image
((const uchar
*)(buffer
),
640,
480,
QImage::Format_RGB888);
qDebug() << "outBuffer.open " << ok;
bool writeSuccess = imgWriter.write(image);
if (!writeSuccess)
{
qDebug() << "write img failed because " << imgWriter.errorString();
}
QImage image((const uchar*)(buffer), 640, 480, QImage::Format_RGB888);
QBuffer outBuffer;
ok = outBuffer.open(QIODevice::ReadWrite);
qDebug() << "outBuffer.open " << ok;
QImageWriter imgWriter(&outBuffer, "JPG");
bool writeSuccess = imgWriter.write(image);
if (!writeSuccess)
{
qDebug() << "write img failed because " << imgWriter.errorString();
}
To copy to clipboard, switch view to plain text mode
The result of this statement
qDebug() << QImageWriter::supportedImageFormats();
To copy to clipboard, switch view to plain text mode
in the app is
("bmp", "jpeg", "jpg", "pbm", "pgm","png", "ppm", "xbm", "xpm")
The output of the same statement inside the dll-code is
("bmp", "pbm", "pgm", "png", "ppm", "xbm", "xpm")
This is how it is deployed:
/test.exe (works fine)
/test2.exe (calls test.dll, doens't work)
/test.dll
/imageformats/qjpeg.dll
I'm using QT 5.2.1 msvc2012_64_opengl
Why don't I have jpg-support inside my dll, while I do have it in my application?
Bookmarks