If this data is being written for the same (or another) Qt program to read then you might be better off using QDataStream to serialise the QVector and QImage/QPixmap etc. As it is you are not really using much of the capability of QDataStream so you could possibly just use the basic QIODevice functions to read() and write(). Use QFile or QBuffer for from-disk or in-memory data respectively.
As it is now you will likely have a jumble of printable and non-printable chars in the file. If you want an on-disk format you can read in a text editor you are better off with QTextStream. When you write the image base 64 encode it so you get printable characters only.
Bookmarks