Results 1 to 2 of 2

Thread: loadFromData failed for DPX which is loaded using Imagemagick

  1. #1

    Default 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

    Qt Code:
    1. void OpenImage(QString path)
    2. {
    3. magickImage.read(path.toStdString());
    4. magickImage.write(&blob);
    5.  
    6. cimgData=((const uchar*)(blob.data()));
    7.  
    8. if(pxmap.loadFromData(cimgData,blob.length())==false)
    9. QMessageBox::information(this,"ImageView","Failed to LoadFromData");
    10.  
    11. update();
    To copy to clipboard, switch view to plain text mode 

    Qt Code:
    1. void WImageView::paintEvent(QPaintEvent *event)
    2. {
    3.  
    4. QPainter p(this);
    5.  
    6. p.drawPixmap(0,0,pxmap.width(),pxmap.height(),pxmap);
    7. }
    To copy to clipboard, switch view to plain text mode 

    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

  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: 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.

Similar Threads

  1. speed up my imagemagick/qt editor
    By yoniekai in forum Qt Programming
    Replies: 5
    Last Post: 5th April 2011, 12:15
  2. Replies: 0
    Last Post: 11th November 2009, 15:09
  3. ImageMagick and QT
    By manojmka in forum Qt Programming
    Replies: 16
    Last Post: 10th April 2008, 14:30
  4. Qt + ImageMagick
    By bpetty in forum Newbie
    Replies: 8
    Last Post: 23rd April 2007, 21:08
  5. how to use loadFromData in painter
    By sar_van81 in forum Qt Programming
    Replies: 18
    Last Post: 31st January 2007, 04:09

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
  •  
Qt is a trademark of The Qt Company.