Results 1 to 12 of 12

Thread: loadFromData() of QImage crash in case of .gif loading

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #7
    Join Date
    May 2007
    Posts
    110
    Thanks
    2
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: loadFromData() of QImage crash in case of .gif loading

    Quote Originally Posted by wysota View Post
    Your image header contains zeroes while it should contain a proper GIF header that informs about things as the dimensions of the image, depth, then the color map, etc.
    To me it seems you are only passing (partial) pixel data and this is not enough. Either create a proper gif header and include it in your buffer or create the QImage object manually and use QImage::bits() to fill it with data in a format compliant with the pixel format (e.g. premultiplied RGBA) of the image you passed when constructing your QImage object.
    /*Your image header contains zeroes while it should contain a proper GIF header that informs about things as the dimensions of the image, depth, then the color map, etc.*/

    In our code, buffer contains the GIF data in hex format, and ofcourse it contains the Starting Header of GIF in Hexformat.


    /*To me it seems you are only passing (partial) pixel data and this is not enough.*/
    No we are sending complete size of GIF data up to files size.

    /*or create the QImage object manually and use QImage::bits() to fill it with data in a format compliant with the pixel format (e.g. premultiplied RGBA) of the image you passed when constructing your QImage object.*/

    Kindly we can work in last sent solution. But we have no QImage's object so how we can

    uchar* imagedata = image.bits();
    we have buffer up to Imagesize, we can use loadFromData() in this case.

    Can I use like this
    Qt Code:
    1. QImage image;
    2. uchar *data1 = QImage::bits();
    3. memcpy(data1,pBuffer,size);
    4. loadFromData(data1,size,"GIF");
    To copy to clipboard, switch view to plain text mode 
    Kindly sent one example for this...
    Last edited by wysota; 7th March 2011 at 10:38.

Similar Threads

  1. loadFromData() of QImage -crash in case of .gif loading
    By santosh.kumar in forum Qt Programming
    Replies: 1
    Last Post: 3rd March 2011, 11:56
  2. Loading a raw image into QImage
    By Luc4 in forum Qt Programming
    Replies: 6
    Last Post: 16th May 2010, 15:20
  3. QImage loadFromData
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 22nd March 2008, 18:57
  4. QImage::loadFromData() behaviour
    By Caius Aérobus in forum Qt Programming
    Replies: 10
    Last Post: 29th November 2007, 21:21
  5. QImage loadFromData not run... XPDF data
    By patrik08 in forum Qt Programming
    Replies: 7
    Last Post: 24th April 2007, 11:51

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.