pix.loadFromData(image);
newRes.setHeight(new Integer(pix.height()).shortValue());
newRes.setWidth(new Integer(pix.width()).shortValue());
logger.log(logger.EXTREME, "Renaming temporary file to " +newRes.getGuid()+".gif");
path = Global.getFileManager().getResDirPath(newRes.getGuid()+".gif");
tfile.rename(path);
} else {
newRes = conn.getNoteTable().noteResourceTable.getNoteResource(latexGuid, false);
path = Global.getFileManager().getResDirPath(newRes.getGuid()+".gif");
tfile = new QFile(path);
tfile.open(new QIODevice.OpenMode(QIODevice.OpenModeFlag.WriteOnly));