
Originally Posted by
wysota
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
uchar
*data1
= QImage::bits();
memcpy(data1,pBuffer,size);
loadFromData(data1,size,"GIF");
QImage image;
uchar *data1 = QImage::bits();
memcpy(data1,pBuffer,size);
loadFromData(data1,size,"GIF");
To copy to clipboard, switch view to plain text mode
Kindly sent one example for this...
Bookmarks