Results 1 to 2 of 2

Thread: Unable to display image in windows

  1. #1

    Default Unable to display image in windows

    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


    Qt Code:
    1. Image magickImage;
    2. Blob blob;
    3. QByteArray imgData;
    4. QPixmap pxmap;
    5.  
    6. magickImage.read("C:\\Test\\test.jpg");
    7.  
    8. magickImage.magick("RGBA");
    9.  
    10. magickImage.write(&blob);
    11.  
    12. imgData = ((char*)(blob.data()));
    13.  
    14. pxmap.loadFromData(imgData,"RGBA");
    15.  
    16. paint.drawPixmap(0,0,pxmap.width(),pxmap.height(),pxmap);
    To copy to clipboard, switch view to plain text mode 

    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
    Last edited by wysota; 6th January 2012 at 16:32.

  2. #2
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Wiki edits
    17

    Default Re: Unable to display image in windows

    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.

Similar Threads

  1. Replies: 1
    Last Post: 24th August 2011, 15:09
  2. Unable to load background image in Main Window
    By bedbuffer in forum Newbie
    Replies: 0
    Last Post: 16th December 2010, 09:40
  3. Unable to view images in an application created for Windows ce
    By mistertwister in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 4th March 2010, 20:23
  4. Unable to display flash into webkit on MAC
    By jay in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2010, 12:23
  5. Image display
    By bmn in forum Qt Programming
    Replies: 1
    Last Post: 5th June 2008, 14:52

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.