[SOLVED] QImage problem - adding/reading path of image with key/text [SOLVED]
Hello, I've written following code:
Code:
bool CMerchandizeBrowser
::embeddedPicPath(QImage image,
QString strFilename
) {
picImageWriter.setFormat(strSupportedFormat); // sets supported format
{
qDebug() << strSupportedFormat << " supports embedded text.";
if (image.text(strKeyImagePathName).isEmpty())
{
// pic path has not yet been saved
image.setText(strKeyImagePathName, strFilename); // sets embedded text
return image.save(strFilename, strSupportedFormat); // saves pic with embedded text
} else {
return false; // path already embedded, abort operation
}
} else {
qDebug() << strSupportedFormat << " does not support embedded text.";
return false; // operation failure
}
return false; // operation failure
}
which is responsible to embedd a QImage path into image, but
Code:
return image.save(strFilename, strSupportedFormat);
returns false. Does anyone has idea why?
Now I thought the chenged picture cannot be written into same filename and I've changed code to:
Code:
bool CMerchandizeBrowser
::embeddedPicPath(QImage image,
QString strFilename
) {
picImageWriter.setFormat(strSupportedFormat); // sets supported format
{
qDebug() << strSupportedFormat << " supports embedded text.";
if (image.text(strKeyImagePathName).isEmpty())
{
// pic path has not yet been saved
image.setText(strKeyImagePathName, strFilename); // sets embedded text
strFilename.insert(strFilename.indexOf(strNameExtDelimiter), strFilenameEmbeddedExtendtor);
qDebug() << "strFilename: " << strFilename; // debug
return image.save(strFilename, strSupportedFormat); // saves pic with embedded text
} else {
return false; // path already embedded, abort operation
}
} else {
qDebug() << strSupportedFormat << " does not support embedded text.";
return false; // operation failure
}
//return true; // operation sucess
}
It works now, thank you all anyway!