Hi everybody,

I'm trying to load an image from raw data, which I get from a database.
For testing purpose I saved the data to a file and wrote the code below but it won't display the image.
I'm not that into processing images, maybe I'm missing something else.

the raw image
an exported version of the image

Qt Code:
  1. QByteArray imagesData;
  2. QFile *file = new QFile(QFileDialog::getOpenFileName(this,tr("Open Image"), "", tr("")));
  3.  
  4. if(file->exists())
  5. {
  6. //get byteArray from raw data file
  7. file->open(QFile::ReadOnly);
  8. imagesData = file->readAll();
  9. file->close();
  10.  
  11. //Create qimage
  12. QImage img((const uchar*)imagesData.data(),4320,2880,QImage::Format_RGB888);
  13.  
  14. QPixmap pix;
  15. pix.fromImage(img);
  16.  
  17. ui->label->setPixmap(pix);
  18. }
To copy to clipboard, switch view to plain text mode 

thanks