Convert RGBA8888 buffer to jpeg buffer in memory
Solved
General and Desktop
-
Hi!
// prepare image in RGBA8888 format QImage img(600, 400, QImage::Format_RGBA8888); { img.fill(QColor("white")); QPainter painter(&img); painter.drawLine(0, 0, 600, 400); painter.drawLine(0, 400, 600, 0); } // save image as JPEG to buffer QByteArray ba; // buffer uses ba as its storage QBuffer buf(&ba); // we'll use buf as QIODevice buf.open(QIODevice::WriteOnly); img.save(&buf, "JPEG");