Writing QImage data to a XML file using QXmlStreamWriter
-
wrote on 18 Jul 2011, 20:46 last edited by
Im building an app in a lab that uses qt as base. We need to write an QImage data to xml file, and later on read that data, we are using QXmlStreamWriter, is there a way to write QImage as a CDATA or something like that with QXmlStreamWriter?
thanks in advance.
-
wrote on 18 Jul 2011, 20:59 last edited by
I suggest you to use base64-encoded image data in xml.
-
wrote on 18 Jul 2011, 21:03 last edited by
ok, where do i start? is there a way to do that with QImages?
-
wrote on 18 Jul 2011, 21:07 last edited by
Use QImage operators >> and << to serialize to/deserialize from QByteArray (using QDataStream) and use fromBase64()/toBase64() methods of QByteArray to store data in base64.
Please, note that operator<< of QImage will not produce valid image data, it will only provide data to use in operator>> -
wrote on 18 Jul 2011, 21:15 last edited by
[quote author="Denis Kormalev" date="1311023269"]Use QImage operators >> and << to serialize to/deserialize from QByteArray (using QDataStream) and use fromBase64()/toBase64() methods of QByteArray to store data in base64.
Please, note that operator<< of QImage will not produce valid image data, it will only provide data to use in operator>>[/quote]thank you very much for your helpful insight, i would never think of that on my own!
-
wrote on 18 Jul 2011, 21:16 last edited by
ProudChild, you are welcome :) Assistant is not a strange heap of information, it is your friend in Qt development :)
1/6