diff --git a/rtengine/dcrop.cc b/rtengine/dcrop.cc index 4d9aff94b..7bf2625ed 100644 --- a/rtengine/dcrop.cc +++ b/rtengine/dcrop.cc @@ -220,8 +220,11 @@ void Crop::update (int todo) { } */ if (cropImageListener) { - // this in workinging space is held in parallel to allow analysis like shadow/highlight - Image8 *cropImgtrue = parent->ipf.lab2rgb (labnCrop, 0,0,cropw,croph, params.icm.working); + // this in output space held in parallel to allow analysis like shadow/highlight + Glib::ustring outProfile=params.icm.output; + if (params.icm.output=="" || params.icm.output==ColorManagementParams::NoICMString) outProfile="sRGB"; + printf("Using profile %s\n", outProfile.c_str()); + Image8 *cropImgtrue = parent->ipf.lab2rgb (labnCrop, 0,0,cropw,croph, outProfile); int finalW = rqcropw; if (cropImg->getWidth()-leftBorder < finalW) diff --git a/rtengine/iccstore.cc b/rtengine/iccstore.cc index 1de273ca1..aa37532de 100644 --- a/rtengine/iccstore.cc +++ b/rtengine/iccstore.cc @@ -60,11 +60,6 @@ std::vector getWorkingProfiles () { return res; } -std::vector getOutputProfiles () { - - return iccStore->getOutputProfiles (); -} - std::vector ICCStore::getOutputProfiles () { Glib::Mutex::Lock lock(mutex_); diff --git a/rtengine/procparams.cc b/rtengine/procparams.cc index a9c6b4cf9..c75bfa1dc 100644 --- a/rtengine/procparams.cc +++ b/rtengine/procparams.cc @@ -928,6 +928,8 @@ if (keyFile.has_group ("IPTC")) { } } +const Glib::ustring ColorManagementParams::NoICMString = Glib::ustring("No ICM: sRGB output"); + bool operator==(const EqualizerParams & a, const EqualizerParams & b) { if(a.enabled != b.enabled) return false; diff --git a/rtengine/procparams.h b/rtengine/procparams.h index 2fb3ef188..b3be7646c 100644 --- a/rtengine/procparams.h +++ b/rtengine/procparams.h @@ -341,6 +341,8 @@ class ColorManagementParams { bool gammaOnInput; Glib::ustring working; Glib::ustring output; + static const Glib::ustring NoICMString; + Glib::ustring gamma; double gampos; double slpos; diff --git a/rtengine/rtengine.h b/rtengine/rtengine.h index ef89aa64b..da7b50e8c 100644 --- a/rtengine/rtengine.h +++ b/rtengine/rtengine.h @@ -314,10 +314,6 @@ namespace rtengine { /** Cleanup the RT engine (static variables) */ void cleanup (); -/** Returns the available output profile names - * @return a vector of the available output profile names */ - std::vector getOutputProfiles (); - /** Returns the available working profile names * @return a vector of the available working profile names */ std::vector getWorkingProfiles (); diff --git a/rtengine/simpleprocess.cc b/rtengine/simpleprocess.cc index ef346cc76..ecae5d102 100644 --- a/rtengine/simpleprocess.cc +++ b/rtengine/simpleprocess.cc @@ -292,12 +292,12 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p ProfileContent pc; - Glib::ustring chpro; + Glib::ustring chpro, outProfile; int present_space[7]={0,0,0,0,0,0,0}; - std::vector opnames = rtengine::getOutputProfiles (); + std::vector opnames = iccStore->getOutputProfiles (); //test if files are in system for (int j=0; j<7;j++) { - //one can modify "option" [Color Management] to adapt name of profile ih there are different for windows, MacOS, Linux ?? + // one can modify "option" [Color Management] to adapt name of profile if there are different for windows, MacOS, Linux ?? if(j==0) chpro=options.rtSettings.prophoto; else if(j==1) chpro=options.rtSettings.adobe; else if(j==2) chpro=options.rtSettings.widegamut; @@ -309,18 +309,17 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p if(chpro.compare(opnames[i]) ==0) present_space[j]=1; if (present_space[j]==0) { if (pl) pl->setProgressStr ("Missing file..");pl->setProgress (0.0);}// display file not present: not very good display information...!! } - //choose output profile - if(params.icm.working=="ProPhoto" && present_space[0]==1) params.icm.output=options.rtSettings.prophoto; - else if(params.icm.working=="Adobe RGB" && present_space[1]==1) params.icm.output=options.rtSettings.adobe; - else if(params.icm.working=="WideGamut" && present_space[2]==1) params.icm.output=options.rtSettings.widegamut; - else if(params.icm.working=="Beta RGB" && present_space[3]==1) params.icm.output=options.rtSettings.beta; - else if(params.icm.working=="BestRGB" && present_space[4]==1) params.icm.output=options.rtSettings.best; - else if(params.icm.working=="BruceRGB" && present_space[5]==1) params.icm.output=options.rtSettings.bruce; - else params.icm.output=options.rtSettings.srgb; //if not found or choice=srgb + // Check that output profiles exist, otherwise revert to sRGB + if (params.icm.output=="ProPhoto" && present_space[0]==1) outProfile=options.rtSettings.prophoto; + else if (params.icm.output=="Adobe RGB" && present_space[1]==1) outProfile=options.rtSettings.adobe; + else if (params.icm.output=="WideGamut" && present_space[2]==1) outProfile=options.rtSettings.widegamut; + else if (params.icm.output=="Beta RGB" && present_space[3]==1) outProfile=options.rtSettings.beta; + else if (params.icm.output=="BestRGB" && present_space[4]==1) outProfile=options.rtSettings.best; + else if (params.icm.output=="BruceRGB" && present_space[5]==1) outProfile=options.rtSettings.bruce; + else outProfile=options.rtSettings.srgb; //if not found or choice=srgb - if (params.icm.output.compare (0, 6, "No ICM") && params.icm.output!="") - pc = iccStore->getContent (params.icm.output); + pc = iccStore->getContent (outProfile); readyImg->setOutputProfile (pc.data, pc.length); @@ -413,7 +412,7 @@ IImage16* processImage (ProcessingJob* pjob, int& errorCode, ProgressListener* p ProfileContent pc; - if (params.icm.output.compare (0, 6, "No ICM") && params.icm.output!="") + if (params.icm.output!="" && params.icm.output!=ColorManagementParams::NoICMString) pc = iccStore->getContent (params.icm.output); readyImg->setOutputProfile (pc.data, pc.length); diff --git a/rtgui/icmpanel.cc b/rtgui/icmpanel.cc index 75d9917c7..9e726b2a6 100644 --- a/rtgui/icmpanel.cc +++ b/rtgui/icmpanel.cc @@ -20,6 +20,7 @@ #include #include #include +#include using namespace rtengine; using namespace rtengine::procparams; @@ -134,7 +135,7 @@ ICMPanel::ICMPanel () : Gtk::VBox(), FoldableToolPanel(this), iunchanged(NULL), onames->append_text (M("TP_ICM_NOICM")); onames->set_active (0); - std::vector opnames = rtengine::getOutputProfiles (); + std::vector opnames = iccStore->getOutputProfiles (); for (int i=0; iappend_text (opnames[i]); @@ -201,7 +202,7 @@ void ICMPanel::read (const ProcParams* pp, const ParamsEdited* pedited) { wnames->set_active_text (pp->icm.working); wgamma->set_active_text (pp->icm.gamma); - if (pp->icm.output=="No ICM: sRGB output") + if (pp->icm.output==ColorManagementParams::NoICMString) onames->set_active_text (M("TP_ICM_NOICM")); else onames->set_active_text (pp->icm.output); @@ -258,7 +259,7 @@ void ICMPanel::write (ProcParams* pp, ParamsEdited* pedited) { pp->icm.gamma = wgamma->get_active_text (); if (onames->get_active_text()==M("TP_ICM_NOICM")) - pp->icm.output = "No ICM: sRGB output"; + pp->icm.output = ColorManagementParams::NoICMString; else pp->icm.output = onames->get_active_text(); pp->icm.freegamma = freegamma->get_active();