loadFromData failed for DPX which is loaded using Imagemagick
Hi,
I created an application to load images. To support many formats i used ImageMagick. I wrote the following code to read images
Code:
{
magickImage.read(path.toStdString());
magickImage.write(&blob);
cimgData=((const uchar*)(blob.data()));
if(pxmap.loadFromData(cimgData,blob.length())==false)
QMessageBox::information(this,
"ImageView",
"Failed to LoadFromData");
update();
Code:
{
p.drawPixmap(0,0,pxmap.width(),pxmap.height(),pxmap);
}
The above code is working for TIF, JPEG, PNG etc. but not working for DPX, CIN, TGA, jp2 (Motion JPG).
For these images "loadFromData" returns false.
Can you please help me how to convert the dpx data to QPixmap?
Thanks in advance
anki.n
Re: loadFromData failed for DPX which is loaded using Imagemagick
QPixmap has a range of formats it knows about. The ones it knows about work directly. You can construct a QImage from raw data in a number of formats, and you can convert a QImage to a QPixmap.
Use ImageMagick to convert the foreign formats to ones that Qt can handle.