Just to sum up this thread for anyone else having this issue, this would be the correct way to do it: QImage img; unsigned char* data; data = new unsigned char[4*width*height*sizeof(unsigned char)]; img = QImage((uchar*)(data),width,height,QImage::Format_RGBA8888); Make sure you allocate the appropriate space needed. E.g. if image format is RGB, size of the data array will be 3 * width * height * sizeof(unsigned char) and the QImage format will be QImage::Format_RGB888. Thanks all for your help.