diff --git a/rtgui/main.cc b/rtgui/main.cc index d588b708d..1ffa5c1b8 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -88,7 +88,7 @@ static void myGdkLockLeave() { * -2 if an error occurred during processing * -3 if at least one required procparam file was not found */ int processLineParams( int argc, char **argv ); - + int main(int argc, char **argv) { setlocale(LC_ALL,""); @@ -152,40 +152,40 @@ int main(int argc, char **argv) #ifdef WIN32 bool consoleOpened = false; - - if (argc>1 || options.rtSettings.verbose){ + + if (argc>1 || options.rtSettings.verbose){ if(options.rtSettings.verbose || ( !safe_file_test( safe_filename_to_utf8(argv[1]), Glib::FILE_TEST_EXISTS ) && !safe_file_test( safe_filename_to_utf8(argv[1]), Glib::FILE_TEST_IS_DIR ))) { bool stdoutRedirectedtoFile = (GetFileType(GetStdHandle(STD_OUTPUT_HANDLE)) == 0x0001); bool stderrRedirectedtoFile = (GetFileType(GetStdHandle(STD_ERROR_HANDLE)) == 0x0001); // no console, if stdout and stderr both are redirected to file - if( !(stdoutRedirectedtoFile && stderrRedirectedtoFile)) { - // check if parameter -w was passed. - // We have to do that in this step, because it controls whether to open a console to show the output of following steps - bool Console = true; - for(int i=1;i1 || options.rtSettings.verbose){ @@ -397,9 +397,18 @@ int processLineParams( int argc, char **argv ) } } break; + case 'b': + sscanf(&argv[iArg][2],"%d",&bits); + if (bits != 8 && bits != 16) + { + std::cerr << "Error: specify -b8 for 8-bit or -b16 for 16-bit output." << std::endl; + deleteProcParams(processingParams); + return -3; + } + break; case 't': outputType = "tif"; - compression = ((argv[iArg][2]!='1')?0:1); + compression = ((argv[iArg][2]!='z')?0:1); break; case 'n': outputType = "png"; @@ -433,25 +442,30 @@ int processLineParams( int argc, char **argv ) inputFiles.push_back( safe_filename_to_utf8 (argv[iArg]) ); } } - break; + break; #ifdef WIN32 - case 'w': // This case is handled outside this function - break; + case 'w': // This case is handled outside this function + break; #endif case 'h': case '?': default: { Glib::ustring pparamsExt = paramFileExtension.substr(1); + std::cout << " indicate parameters you can change." << std::endl; + std::cout << "[Square brackets] mean the parameter is not mandatory." << std::endl; + std::cout << "The pipe symbol | indicates a choice of one or the other." << std::endl; + std::cout << "The dash symbol - denotes a range of possible values from one to the other." << std::endl; + cout << std::endl; std::cout << "Usage:" << std::endl; - std::cout << " " << Glib::path_get_basename(argv[0]) << " [] Start File Browser inside directory." << std::endl; + std::cout << " " << Glib::path_get_basename(argv[0]) << " Start File Browser inside directory." << std::endl; std::cout << " " << Glib::path_get_basename(argv[0]) << " Start Image Editor with file." << std::endl; - std::cout << " " << Glib::path_get_basename(argv[0]) << " -c | Convert files in batch with default parameters." << std::endl << std::endl; -#ifdef WIN32 - std::cout << " -w Do not open the Windows console" << std::endl; + std::cout << " " << Glib::path_get_basename(argv[0]) << " -c | Convert files in batch with default parameters." << std::endl << std::endl; +#ifdef WIN32 + std::cout << " -w Do not open the Windows console" << std::endl; #endif std::cout << "Other options used with -c (-c must be the last option):" << std::endl; - std::cout << Glib::path_get_basename(argv[0]) << " [-o |-O ] [-s|-S] [-p ] [-d] [-j[1-100]|-t|-t1|-n] -Y -c " << std::endl; + std::cout << Glib::path_get_basename(argv[0]) << " [-o |-O ] [-s|-S] [-p ] [-d] [-j[1-100] [-js<1-3>]|[-b<8|16>] <[-t[z] | [-n]]] [-Y] -c " << std::endl; std::cout << " -o | Select output file or directory." << std::endl; std::cout << " -O | Select output file or directory and copy " << pparamsExt << " file into it." << std::endl; std::cout << " -s Include the " << pparamsExt << " file next to the input file (with the same" << std::endl; @@ -465,16 +479,17 @@ int processLineParams( int argc, char **argv ) std::cout << " You can specify as many -p options as you like (see" << std::endl; std::cout << " description below)." << std::endl; std::cout << " -d Use the default raw or non-raw " << pparamsExt << " file as set in" << std::endl; - std::cout << " Preferences > Image Processing > Default Image Processing Parameters" << std::endl; + std::cout << " Preferences > Image Processing > Default Processing Profile" << std::endl; std::cout << " -j[1-100] Specify output to be JPEG (on by default). Optionally add" << std::endl; std::cout << " compression 1-100 (default value: 100)." << std::endl; - std::cout << " -js1-3 Specify the JPEG subsampling parameter, where:" << std::endl; + std::cout << " -js<1-3> Specify the JPEG subsampling parameter, where:" << std::endl; std::cout << " 1 = Best compression: 2x2, 1x1, 1x1 (4:1:1) - default of the JPEG library" << std::endl; std::cout << " 2 = Widely used normal ratio: 2x1, 1x1, 1x1 (4:2:2)" << std::endl; std::cout << " 3 = Best quality: 1x1, 1x1, 1x1 (4:4:4)" << std::endl; - std::cout << " -t Specify output to be uncompressed 16-bit TIFF." << std::endl; - std::cout << " -t1 Specify output to be compressed 16-bit TIFF (ZIP compression)." << std::endl; - std::cout << " -n Specify output to be compressed 16-bit PNG." << std::endl; + std::cout << " -b<8|16> Specify bit depth per channel (only applies to TIFF and PNG output)." << std::endl; + std::cout << " -t[z] Specify output to be TIFF (16-bit if -b8 is not set)." << std::endl; + std::cout << " Uncompressed by default, or ZIP compression with 'z'" << std::endl; + std::cout << " -n Specify output to be compressed PNG (16-bit if -b8 is not set)." << std::endl; std::cout << " -Y Overwrite output if present." << std::endl<load(Glib::build_filename(profPath, Glib::path_get_basename(options.defProfRaw) + paramFileExtension))) { - std::cerr << "Error: default Raw procparams file not found" << std::endl; + std::cerr << "Error: default raw processing profile not found" << std::endl; rawParams->deleteInstance(); delete rawParams; deleteProcParams(processingParams); @@ -532,7 +547,7 @@ int processLineParams( int argc, char **argv ) imgParams = new rtengine::procparams::PartialProfile(true); profPath = options.findProfilePath(options.defProfImg); if (options.is_defProfImgMissing() || profPath.empty() || imgParams->load(Glib::build_filename(profPath, Glib::path_get_basename(options.defProfImg) + paramFileExtension))) { - std::cerr << "Error: default Image procparams file not found" << std::endl; + std::cerr << "Error: default non-raw processing profile not found" << std::endl; imgParams->deleteInstance(); delete imgParams; rawParams->deleteInstance(); @@ -581,13 +596,13 @@ int processLineParams( int argc, char **argv ) continue; } - // Load the image - isRaw = true; + // Load the image + isRaw = true; Glib::ustring ext = getExtension (inputFile); - if (ext.lowercase()=="jpg" || ext.lowercase()=="jpeg" || ext.lowercase()=="tif" || ext.lowercase()=="tiff" || ext.lowercase()=="png") + if (ext.lowercase()=="jpg" || ext.lowercase()=="jpeg" || ext.lowercase()=="tif" || ext.lowercase()=="tiff" || ext.lowercase()=="png") isRaw = false; - ii = rtengine::InitialImage::load ( inputFile, isRaw, &errorCode, NULL ); + ii = rtengine::InitialImage::load ( inputFile, isRaw, &errorCode, NULL ); if (!ii) { errors++; std::cerr << "Error loading file: "<< inputFile << std::endl; @@ -596,11 +611,11 @@ int processLineParams( int argc, char **argv ) if (useDefault) { if (isRaw) { - std::cout << " Merging default Raw profile" << std::endl; + std::cout << " Merging default raw processing profile" << std::endl; rawParams->applyTo(¤tParams); } else { - std::cout << " Merging default Image profile" << std::endl; + std::cout << " Merging default non-raw processing profile" << std::endl; imgParams->applyTo(¤tParams); } } @@ -680,4 +695,4 @@ int processLineParams( int argc, char **argv ) return errors>0?-2:0; } - +