From 4fefc9433a9c1114630898bab3c0a4c0564b0097 Mon Sep 17 00:00:00 2001 From: Morgan Hardwood Date: Sun, 4 Nov 2018 19:06:54 +0100 Subject: [PATCH] Fixes unspecified bit depth in CLI In rawtherapee-cli, if you did not explcitly specify a bit depth then -1 was used and lead to corrupted saved images. Fixes #4937 --- rtgui/main-cli.cc | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/rtgui/main-cli.cc b/rtgui/main-cli.cc index 26ee4fa81..66e0b9cfc 100644 --- a/rtgui/main-cli.cc +++ b/rtgui/main-cli.cc @@ -410,8 +410,6 @@ int processLineParams ( int argc, char **argv ) return -3; } - std::cout << "Output is " << bits << "-bit " << (isFloat ? "floating-point" : "integer") << "." << std::endl; - break; case 't': @@ -622,6 +620,18 @@ int processLineParams ( int argc, char **argv ) } } + if (bits == -1) { + if (outputType == "jpg") { + bits = 8; + } else if (outputType == "png") { + bits = 8; + } else if (outputType == "tif") { + bits = 16; + } else { + bits = 8; + } + } + if ( !argv1.empty() ) { return 1; } @@ -662,6 +672,7 @@ int processLineParams ( int argc, char **argv ) rtengine::procparams::ProcParams currentParams; Glib::ustring inputFile = inputFiles[iFile]; + std::cout << "Output is " << bits << "-bit " << (isFloat ? "floating-point" : "integer") << "." << std::endl; std::cout << "Processing: " << inputFile << std::endl; rtengine::InitialImage* ii = nullptr;