PDA

View Full Version : Unable to display image in windows



ankireddy
6th January 2012, 09:15
Hello Experts,

I am trying to display an image using ImageMagick library in Windows XP. But it is not displaying any thing. I wrote the code as bellow



Image magickImage;
Blob blob;
QByteArray imgData;
QPixmap pxmap;

magickImage.read("C:\\Test\\test.jpg");

magickImage.magick("RGBA");

magickImage.write(&blob);

imgData = ((char*)(blob.data()));

pxmap.loadFromData(imgData,"RGBA");

paint.drawPixmap(0,0,pxmap.width(),pxmap.height(), pxmap);

This code is not displaying any thing on screen. If I place "XMP" instead of "RGBA" then the code is working on Linux. But with XMP the application is breaking in windows.

Can you please help me what's the wrong with the above code.

Thanks in advance
ankireddy.n

ChrisW67
7th January 2012, 03:58
At the very least your arguments the QPixmap::loadFromData() are wrong. You should also check the return value to see if the data was successfully loaded.