hi ,I write picture data to file by QDataStream,and I want get the picture data from the file as 'char*' 。
How can I do this? thansk!
hi ,I write picture data to file by QDataStream,and I want get the picture data from the file as 'char*' 。
How can I do this? thansk!
take a look at QImage::fromData.
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
thanks !
I have got QImage object! I want to known than how to convert QImage to char*?
example:
I want a function like this:
char* readimage(QString filepath); // I don't know how to convert QImage to char*!
this is ok .I have already got QImage from file.
QImage readimage(QString filepath); //
there is an example in Qt Assistant (take a look at description of QImage::save):
Qt Code:
QImage image; QByteArray ba; image.save(&buffer, "PNG"); // writes image into ba in PNG formatTo copy to clipboard, switch view to plain text mode
Qt Assistant -- rocks!
please, use tags [CODE] & [/CODE].
May be QImage::bits might help you
thanks !
the problem was fixed!
Bookmarks