sqarpi
1st September 2010, 12:41
Hello again.
I have problems with saving qImage to jpg.
On the very begining i was trying to use QPixmap::save() like this:
QString saveFile=QFileDialog::getSaveFileName(this,tr("save"),QDir::homePath());
if(!saveFile.isEmpty())
if(!tlo->save(saveFile,".JPG",100));
but it didn't work(no errors, just was not saving file), so i have tried qimagewriter and... on the one computer it's working on the other not... the code is:
QString saveFile=QFileDialog::getSaveFileName(this,tr("save"),QDir::homePath());
if(!saveFile.isEmpty()){
QImageWriter writer(saveFile);
writer.write(*tlo);
if(writer.canWrite())
qDebug("i can write");
else
qDebug("i can't write");
qDebug()<< writer.errorString();
}
it shows me "i can write" co there is no problems with opening file to write and no problems with qimage... the error line is "unknown problem"
any ideas about the solution? any ideas why save() didn't work? i really will appreciate help.
thank
I have problems with saving qImage to jpg.
On the very begining i was trying to use QPixmap::save() like this:
QString saveFile=QFileDialog::getSaveFileName(this,tr("save"),QDir::homePath());
if(!saveFile.isEmpty())
if(!tlo->save(saveFile,".JPG",100));
but it didn't work(no errors, just was not saving file), so i have tried qimagewriter and... on the one computer it's working on the other not... the code is:
QString saveFile=QFileDialog::getSaveFileName(this,tr("save"),QDir::homePath());
if(!saveFile.isEmpty()){
QImageWriter writer(saveFile);
writer.write(*tlo);
if(writer.canWrite())
qDebug("i can write");
else
qDebug("i can't write");
qDebug()<< writer.errorString();
}
it shows me "i can write" co there is no problems with opening file to write and no problems with qimage... the error line is "unknown problem"
any ideas about the solution? any ideas why save() didn't work? i really will appreciate help.
thank