crossplatform: exif copy using exiftool under non-windows platform
This commit is contained in:
parent
7723783f3c
commit
3b2d4b6299
@ -1543,8 +1543,9 @@ void Caesium::runPreview()
|
||||
}
|
||||
if (settings.value("Preferences/exif").value<bool>())
|
||||
{
|
||||
QString exec = "\"" + ui->listTreeWidget->selectedItems().at(i)->text(7) + "\" \"" + tempFolder + "/_caesium_/" + rndString + ".cae\"";
|
||||
startBlockingProcess("tools\\exif_copy.exe", exec);
|
||||
QString sourceImagePath = ui->listTreeWidget->selectedItems().at(i)->text(7);
|
||||
QString destImagePath = tempFolder + QDir::separator() + "_caesium_" + QDir::separator() + rndString + ".cae";
|
||||
copyExif(sourceImagePath, destImagePath);
|
||||
}
|
||||
ui->listTreeWidget->selectedItems().at(i)->setText(2, fixedSize(info.size(), 0));
|
||||
ui->listTreeWidget->selectedItems().at(i)->setText(3, getRatio(orig.size(), info.size()));
|
||||
|
@ -171,8 +171,8 @@ void CompressionThread::run()
|
||||
|
||||
if (settings.value("Preferences/exif").value<bool>() && t_format.toLower() == "jpg")
|
||||
{
|
||||
QString exec = "\"" + t_list.at(i) + "\" \"" + t_dir + "\\" + info.completeBaseName() + t_suffix +"\"";
|
||||
startBlockingProcess("tools\\exif_copy.exe", exec);
|
||||
QString destImagePath = t_dir + QDir::separator() + info.completeBaseName() + t_suffix;
|
||||
copyExif(t_list.at(i), destImagePath);
|
||||
}
|
||||
QFile newImage(t_dir + "/" + info.completeBaseName() + t_suffix);
|
||||
QFileInfo newInfo;
|
||||
@ -283,8 +283,8 @@ void CompressionThread::noEnlarge()
|
||||
|
||||
if (settings.value("Preferences/exif").value<bool>() && t_format.toLower() == "jpg")
|
||||
{
|
||||
QString exec = "\"" + t_list.at(i) + "\" \"" + t_dir + "\\" + info.completeBaseName() + t_suffix + "." + t_format + "\"";
|
||||
startBlockingProcess("tools\\exif_copy.exe", exec);
|
||||
QString destImagePath = t_dir + QDir::separator() + info.completeBaseName() + t_suffix + "." + t_format;
|
||||
copyExif(t_list.at(i), destImagePath);
|
||||
}
|
||||
|
||||
QFileInfo newInfo(t_dir + "/" + info.completeBaseName() + t_suffix + "." + t_format + ".ckd");
|
||||
@ -332,6 +332,10 @@ void CompressionThread::keepDate(const QString & orig, const QString & dest)
|
||||
|
||||
void CompressionThread::optimizePNG(QString file, int level)
|
||||
{
|
||||
QString exec = "-o" + QString::number(level) + " \"" + file + "\"";
|
||||
QString exec = QString(R"(-o %1 "%2")").arg(QString::number(level), file);
|
||||
#ifdef Q_OS_WIN
|
||||
startBlockingProcess("tools\\optipng.exe", exec);
|
||||
#else
|
||||
startBlockingProcess("optipng", exec);
|
||||
#endif
|
||||
}
|
||||
|
14
global.cpp
14
global.cpp
@ -1,6 +1,7 @@
|
||||
/*******************************************************************************
|
||||
#
|
||||
# Copyright (C) 2010-2013 Matteo Paonessa <matteo.paonessa@gmail.com>
|
||||
# 2021 Gary Wang <wzc782970009@gmail.com>
|
||||
#
|
||||
# This file is part of the Caesium distribution.
|
||||
#
|
||||
@ -49,3 +50,16 @@ void startBlockingProcess(const QString & program, const QString & argv)
|
||||
proc.waitForFinished(INT_MAX);
|
||||
return;
|
||||
}
|
||||
|
||||
void copyExif(const QString &sourceImagePath, const QString &destImagePath)
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
QString exec = QString(R"("%1" "%2")").arg(sourceImagePath, destImagePath);
|
||||
startBlockingProcess("tools\\exif_copy.exe", exec);
|
||||
#else
|
||||
// blumia: This is much slower than the existing exif_copy.exe since it won't create another file for copy tags.
|
||||
// Maybe writing a small standalone tool to replace the exif_copy.exe could be better.
|
||||
QString exec = QString(R"(-tagsFromFile "%1" -All:All "%2" -overwrite_original)").arg(sourceImagePath, destImagePath);
|
||||
startBlockingProcess("exiftool", exec);
|
||||
#endif
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user