Hi trolltechers,

I'm trying to load an image and then populate another using its "binary data",
For some reason it doesn't work and image2 isn't saved.

Here is the code :

Qt Code:
  1. QImage image("tata.png");
  2.  
  3. unsigned char * bits = image.bits();
  4.  
  5. QImage image2;
  6. image2.loadFromData(bits, image.numBytes() * 8);
  7. image2.convertToFormat(QImage::Format_ARGB32);
  8.  
  9. QString photoPath = "toto.png";
  10.  
  11. if (image2.save(photoPath) == NULL)
  12. {
  13. // Enters here : Image2 cannot be saved
  14. }
To copy to clipboard, switch view to plain text mode 

Any idea ?