Beep6581 / RawTherapee

A powerful cross-platform raw photo processing program
https://rawtherapee.com
GNU General Public License v3.0
2.67k stars 306 forks source link

If raw histogram is active, fall back to RGB histograms when opening non-raw image #4813

Open sguyader opened 5 years ago

sguyader commented 5 years ago

When an raster image (Jpeg, Tiif or PNG) is opened in RT, the histogram is totally flat, whatever the kind is toggled (log or linear). Bug present in current dev in Linux (but was present already in previous build from several days ago):

Version: 5.4-860-g5d00cb05b
Branch: dev
Commit: 5d00cb05b
Commit date: 2018-09-17
Compiler: cc 8.2.1
Processor: x86_64
System: Linux
Bit depth: 64 bits
Gtkmm: V3.22.2
Lensfun: V0.3.95.0
Build type: release
Build flags:  -std=c++11 -march=native -Werror=unused-label -flto -fopenmp -Werror=unknown-pragmas -Wall -Wno-unused-result -Wno-deprecated-declarations -O3 -DNDEBUG -ftree-vectorize
Link flags:  -march=native -flto
OpenMP support: ON
MMAP support: ON
Thanatomanic commented 5 years ago

I'll take a look tonight..

Beep6581 commented 5 years ago

5.4-861-ge50b68208 works fine here @sguyader

screenshot_20180917_183613

Are you sure the "raw histogram" is not toggled? It happened once to me that I also thought the histogram was broken when I was viewing a non-raw file with the raw histogram enabled.

sguyader commented 5 years ago

Ok, I just compiled 5.4-861-ge50b682 and at first it didn't change. I had to delete my options file to get the histogram back for rasters. Sorry about that, I should have done that before reporting a bug. I guess you can close the issue.

Edit: I feel so ashamed... In fact I had "raw histogram" enabled... That's why I saw no histogram for jpeg's... But then, maybe there should be a fallback to regular histogram when a raster image is loaded?

Thanatomanic commented 5 years ago

@Beep6581 @heckflosse Is there an easy way to check what the type of the loaded image is?

heckflosse commented 5 years ago

@Thanatomanic

When an image is loaded, a function named imageTypeChanged is called. Maybe you can use it?

Thanatomanic commented 5 years ago

@sguyader There might have been some cross interference from this c365337

sguyader commented 5 years ago

@Thanatomanic maybe, but I'm pretty sure it was just my dumbness forgetting to revert to RGB histogram after I had checked raw histogram for some raw files.

sguyader commented 5 years ago

Can we close this issue?

Thanatomanic commented 5 years ago

Well, there is still an open issue... When raw mode is set, and a non-raw image is opened, there should be a fallback to the regular histogram. I just haven't gotten to making a fix for this.

Thanatomanic commented 3 years ago

So, I've tried to understand the mechanics of the listener and where to trigger the change. This seemed a reasonable place to start:

diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc
index 938048169..65de0fb0c 100644
--- a/rtengine/improccoordinator.cc
+++ b/rtengine/improccoordinator.cc
@@ -1917,6 +1917,11 @@ void ImProcCoordinator::updatePreviewImage(int todo, bool panningRelatedChange)

         hist_lrgb_dirty = vectorscope_hc_dirty = vectorscope_hs_dirty = waveform_dirty = true;
         if (hListener) {
+
+            if (!imgsrc->isRAW() && options.histogramScopeType == Options::ScopeType::HISTOGRAM_RAW) {
+                options.histogramScopeType = Options::ScopeType::HISTOGRAM;
+            }
+
             if (hListener->updateHistogram()) {
                 updateLRGBHistograms();
             }

When you open a raw file, set the histogram to raw and then open a jpeg/tiff/png it does trigger the change in ScopeType. Because if you close RT and reopen, the regular histogram is selected.

Where I fail to properly understand how to handle this situation, is how to trigger the GUI update. For example, by calling void EditorPanel::scopeTypeChanged(ScopeType new_type) or void HistogramPanel::rgbv_toggled (). Maybe @Lawrence37 can help out here?

Lawrence37 commented 3 years ago

@Thanatomanic You'll want to update the buttons' states as well. I think the best way to handle this is to introduce a signal that the histogram panel listens to. When a new image is loaded, trigger this signal. In the histogram panel, call the set_active() function for the regular histogram button. This should trigger the GUI update as well. https://github.com/Beep6581/RawTherapee/blob/a749a1abb1bfb968429b2f0bcb4badb8515d34eb/rtgui/histogrampanel.h#L284