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>())
|
if (settings.value("Preferences/exif").value<bool>())
|
||||||
{
|
{
|
||||||
QString exec = "\"" + ui->listTreeWidget->selectedItems().at(i)->text(7) + "\" \"" + tempFolder + "/_caesium_/" + rndString + ".cae\"";
|
QString sourceImagePath = ui->listTreeWidget->selectedItems().at(i)->text(7);
|
||||||
startBlockingProcess("tools\\exif_copy.exe", exec);
|
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(2, fixedSize(info.size(), 0));
|
||||||
ui->listTreeWidget->selectedItems().at(i)->setText(3, getRatio(orig.size(), info.size()));
|
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")
|
if (settings.value("Preferences/exif").value<bool>() && t_format.toLower() == "jpg")
|
||||||
{
|
{
|
||||||
QString exec = "\"" + t_list.at(i) + "\" \"" + t_dir + "\\" + info.completeBaseName() + t_suffix +"\"";
|
QString destImagePath = t_dir + QDir::separator() + info.completeBaseName() + t_suffix;
|
||||||
startBlockingProcess("tools\\exif_copy.exe", exec);
|
copyExif(t_list.at(i), destImagePath);
|
||||||
}
|
}
|
||||||
QFile newImage(t_dir + "/" + info.completeBaseName() + t_suffix);
|
QFile newImage(t_dir + "/" + info.completeBaseName() + t_suffix);
|
||||||
QFileInfo newInfo;
|
QFileInfo newInfo;
|
||||||
@ -283,8 +283,8 @@ void CompressionThread::noEnlarge()
|
|||||||
|
|
||||||
if (settings.value("Preferences/exif").value<bool>() && t_format.toLower() == "jpg")
|
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 + "\"";
|
QString destImagePath = t_dir + QDir::separator() + info.completeBaseName() + t_suffix + "." + t_format;
|
||||||
startBlockingProcess("tools\\exif_copy.exe", exec);
|
copyExif(t_list.at(i), destImagePath);
|
||||||
}
|
}
|
||||||
|
|
||||||
QFileInfo newInfo(t_dir + "/" + info.completeBaseName() + t_suffix + "." + t_format + ".ckd");
|
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)
|
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);
|
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>
|
# Copyright (C) 2010-2013 Matteo Paonessa <matteo.paonessa@gmail.com>
|
||||||
|
# 2021 Gary Wang <wzc782970009@gmail.com>
|
||||||
#
|
#
|
||||||
# This file is part of the Caesium distribution.
|
# This file is part of the Caesium distribution.
|
||||||
#
|
#
|
||||||
@ -49,3 +50,16 @@ void startBlockingProcess(const QString & program, const QString & argv)
|
|||||||
proc.waitForFinished(INT_MAX);
|
proc.waitForFinished(INT_MAX);
|
||||||
return;
|
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
|
||||||
|
}
|
||||||
|
1
global.h
1
global.h
@ -13,5 +13,6 @@ extern QString opened_list;
|
|||||||
|
|
||||||
bool isJpegSuffix(const QString & suffix);
|
bool isJpegSuffix(const QString & suffix);
|
||||||
void startBlockingProcess(const QString &program, const QString & exec);
|
void startBlockingProcess(const QString &program, const QString & exec);
|
||||||
|
void copyExif(const QString & sourceImagePath, const QString & destImagePath);
|
||||||
|
|
||||||
#endif // GLOBAL_H
|
#endif // GLOBAL_H
|
||||||
|
Loading…
Reference in New Issue
Block a user