I am doing something like this:
QImage image(width, height, QImage::Format_RGB32);
frame.fill(QColor(255, 255, 255).rgb());
QBuffer buffer;
buffer.open(QBuffer::ReadWrite);
QDataStream out(&buffer);
Option 1:
out << image;
Option 2:
out.writeRawData((char *) image.constBits(), image.byteCount()) ;
Option 1 is pretty slow and I am not sure if Option 2 is the correct way to do?