C++ (Qt)QImage CreateImage( const QVector<char> & src, int w, int h ){ QImage img(w, h, QImage::Format_Indexed8); static QVector<QRgb> colorTable; if (!colorTable.size()) { colorTable.resize(256); for (int i = 0; i < 256; ++i) colorTable[i] = qRgba(i, i, i, 255); } img.setColorTable(colorTable); for (int y = 0; y < h; ++y) memmove(img.scanLine(y), &src[0] + y * w, w); return img;}