bunjee
22nd March 2008, 12:06
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 :
QImage image("tata.png");
unsigned char * bits = image.bits();
QImage image2;
image2.loadFromData(bits, image.numBytes() * 8);
image2.convertToFormat(QImage::Format_ARGB32);
QString photoPath = "toto.png";
if (image2.save(photoPath) == NULL)
{
// Enters here : Image2 cannot be saved
}
Any idea ?
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 :
QImage image("tata.png");
unsigned char * bits = image.bits();
QImage image2;
image2.loadFromData(bits, image.numBytes() * 8);
image2.convertToFormat(QImage::Format_ARGB32);
QString photoPath = "toto.png";
if (image2.save(photoPath) == NULL)
{
// Enters here : Image2 cannot be saved
}
Any idea ?