GNOME Bugzilla – Bug 141930
Grayscale auto level slider problem
Last modified: 2004-06-28 14:40:51 UTC
Win2000 GIMP 2.0.1 GTK2.2.4 I opened a blackwhite image. Do a auto level. Sliders move and everything is fine. If I make a duplicate layer and do auto level, sliders do not move but image is leveled. Don't know if this is same as Bug 84640: Clicking the Auto Button in the levels tool is weird. Mine seems to happen with the duplicate layer. Original layer works fine(even after creating duplicate layer).
Note that for an RGB image "Auto Levels" works on the R,G and B channel but not on the "Value" channel which is what you are looking at by default. This is differently for a grayscale image where "Auto Levels" works on the Value channel because that's the only available channel. I assume you created your "Duplicate" by copy and paste? Your duplicate became an RGB image then. Closing as NOTABUG. If you disagree with my explanation, you can reopen it and provide more info.
I understand your explanation and it could just be my misunderstanding since I'm new to this graphics stuff. The grayscale image I am working on can be found at http://www.digitalretouch.org/download/ch_02/ch02_small/ch2_icecream_sm.jpg 1. I make duplicate by right-click -> Layer -> duplicate layer. 2. Right-click -> Layer -> Colors -> Levels -> Auto. Looking at the channel dropdown of the duplicated layer, I only have value & alpha channels (Red, Green, Blue channel options are diabled). This means it's still grayscale right?
I can confirm this in Gimp 2.1.1. It actually is a function of whether the layer has an alpha channel. If you invoke Levels on a grayscale layer with no alpha channel, and press Auto, everything happens correctly. If the layer has an alpha channel, though, the adjustment takes place correctly but the sliders and spinbuttons for the Value channel in the Input Levels histogram do not update.
This is probably breakage introduced by the fix to bug #132322. I have removed a couple of small code blocks that began "if (! l_tool->color && l_tool->alpha)", and it corrected the current problem. However, I did not understand the comments in bug #132322, so I may have broken something else as a consequence. 2004-06-27 Bill Skaggs <weskaggs@primate.ucdavis.edu> * app/tools/gimplevelstool.c: removed two small chunks of code. Fixes bug #141930. Possibly unfixes bug #132322.
Why are you messing with this code if you don't understand it? And why do you commit the change to CVS if you aren't sure that it is right? This is some very fragile stuff, mainly because the underlying API is horribly broken. The lines you removed served a purpose. Please revert your change and let's come up with a clean solution.
Reverted because these hacks doesn't need to be removed, but also applied to the auto functionality. 2004-06-28 Michael Natterer <mitch@gimp.org> * app/tools/gimplevelstool.c: reverted fix for bug #141930. These hacks are there because the enum used in levels doesn't match the enum used by the combo box and the histogram widget.
Fixed in HEAD and gimp-2-0: 2004-06-28 Michael Natterer <mitch@gimp.org> Fixed bug #141930 while keeping bug #132322 fixed: * app/base/curves.c (curves_lut_func) * app/base/levels.c (levels_lut_func): changed meaning of channel slots for GRAYA images: just as for GRAY images, expect the value channel in slot 0 and the alpha channel in slot 1, so it matches the meaning of slots of GimpHistogram (before this change, only GRAY images had their value in slot 0 and GRAYA images had it in slot 1, whereas the histogram had the value channel in slot 0, which was breaking auto levels for GRAYA images). * app/tools/gimpcurvestool.c * app/tools/gimplevelstool.c * tools/pdbgen/pdb/color.pdb: adjusted channel fiddling for GRAY and GRAYA images accordingly. * app/tools/gimpcurvestool.c (curves_update) * app/tools/gimplevelstool.c (levels_update): call gimp_color_bar_set_buffers() with the right buffers. * app/pdb/color_cmds.c: regenerated.