I'm trying to load an image that has no header to determine type.
How do I specify what format I want?
QString path = "..."
QImage* myVar = new QImage(path, (char *)QImage::Format_RGB32);
Causes a seg fault
Please help.
Printable View
I'm trying to load an image that has no header to determine type.
How do I specify what format I want?
QString path = "..."
QImage* myVar = new QImage(path, (char *)QImage::Format_RGB32);
Causes a seg fault
Please help.
--Solved--
Here's how I found to make it work:
QString path = "..."
QImage* myVar = new QImage(path, "PNG");
QImage* var2 = myVar->convertToFormat(QImage::Format_RGB32, Qt::ThresholdDither));
It may look wasteful, but I needed the second copy anyway. For anyone else stuck, there you go.
But this suggests your image has a PNG header... If you have only the raw data, you should use QImage::loadFromData().