From e692c820310c87240b5382d8dff2c2b01a940a9a Mon Sep 17 00:00:00 2001 From: Javier Celaya Date: Tue, 9 Dec 2014 19:25:01 +0100 Subject: [PATCH] Ignore single images in batch mode. --- Launcher.cpp | 7 +++++++ LoadSaveOptions.hpp | 4 +++- hdrmerge_es.ts | 8 ++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Launcher.cpp b/Launcher.cpp index 082ae0b..9a566e1 100644 --- a/Launcher.cpp +++ b/Launcher.cpp @@ -115,6 +115,10 @@ int Launcher::automaticMerge() { ImageIO io; int result = 0; for (LoadOptions & options : optionsSet) { + if (!options.withSingles && options.fileNames.size() == 1) { + Log::progress(tr("Skipping single image %1").arg(options.fileNames.front())); + continue; + } CoutProgressIndicator progress; int numImages = options.fileNames.size(); int result = io.load(options, progress); @@ -168,6 +172,8 @@ void Launcher::parseCommandLine() { generalOptions.crop = false; } else if (string("--batch") == argv[i] || string("-B") == argv[i]) { generalOptions.batch = true; + } else if (string("--single") == argv[i]) { + generalOptions.withSingles = true; } else if (string("--help") == argv[i]) { help = true; } else if (string("-b") == argv[i]) { @@ -240,6 +246,7 @@ void Launcher::showHelp() { cout << " " << "-B|--batch " << tr("Batch mode: Input images are automatically grouped into bracketed sets,") << endl; cout << " " << " " << tr("by comparing the creation time. Implies -a if no output file name is given.") << endl; cout << " " << "-g gap " << tr("Batch gap, maximum difference in seconds between two images of the same set.") << endl; + cout << " " << "--single " << tr("Include single images in batch mode (the default is to skip them.)") << endl; cout << " " << "-b BPS " << tr("Bits per sample, can be 16, 24 or 32.") << endl; cout << " " << "--no-align " << tr("Do not auto-align source images.") << endl; cout << " " << "--no-crop " << tr("Do not crop the output image to the optimum size.") << endl; diff --git a/LoadSaveOptions.hpp b/LoadSaveOptions.hpp index 4f9c79f..70badfd 100644 --- a/LoadSaveOptions.hpp +++ b/LoadSaveOptions.hpp @@ -34,7 +34,9 @@ struct LoadOptions { bool crop; bool batch; double batchGap; - LoadOptions() : align(true), crop(true), batch(false), batchGap(2.0) {} + bool withSingles; + LoadOptions() : align(true), crop(true), batch(false), batchGap(2.0), + withSingles(false) {} }; diff --git a/hdrmerge_es.ts b/hdrmerge_es.ts index 156b12f..f791821 100644 --- a/hdrmerge_es.ts +++ b/hdrmerge_es.ts @@ -135,6 +135,10 @@ Invalid %1 parameter, using default. Parámetro %1 inválido, se usará el valor por defecto. + + Include single images in batch mode (the default is to skip them.) + Incluir imágenes sueltas en modo lote (por defecto se ignoran). + LoadSave @@ -182,6 +186,10 @@ Done writing! ¡Escritura finalizada! + + Skipping single image %1 + Ignorando la imagen suelta %1 + hdrmerge::AboutDialog