GNOME Bugzilla – Bug 343911
Description of "Selection sharpen" operation is incorrect
Last modified: 2006-06-05 20:36:10 UTC
Please describe the problem: The description of the PDB function 'gimp_selection_sharpen' specifies that if the pixel's value is greater than zero, the pixel is assigned the value of 255. In actuality, pixels with values ranging from 0 to 127 are assigned the value of "0" and pixels in the range 128 to 255 are assigned the value of "255". Steps to reproduce: 1. Make a selection. 2. Feather the selection 3. Perform an <Image>/Select/Sharpen Actual results: The resulting selection no longer includes the extremes of the feathering. Expected results: The resulting selection should include every pixel which previously had a non-zero value. Does this happen every time? Yes. Other information: Line 1092 of the file 'app/core/gimpchannel.c' appears to be where threshold is specified as "127". lut = threshold_lut_new (0.5, 1)
The docs seem to be wrong here, the behaviour is IMO correct.
Not to be overly argumentative, but I would propose for discussion that the behavior as documented would prove more useful. When partial alpha values are to be used in an animated GIF (for example, anti-aliased text), unless it is "processed" beforehand, the image is aliased. One way around this is to perform an "Alpha to selection", "sharpen" the selection, "Copy visible" the layers underneath, and then Merge Down the original layer. This results in a layer that contains only the appropriate pixels, properly anti-aliased. With the present behavior of "select->sharpen", the "sharpen" has to be performed by saving the selection mask to a channel, performing a Threshold on the channel, and then restoring the channel to the selection mask. I understand changing the behavior might break things (I think this is unlikely, as noone has reported the documentation error previously), the "safe" thing to do is to change the documentation; but I can't think of any situation were having the threshold set at "127" (as it currently is) would be similarly useful.
Editing animated GIFs is not what GIMP is meant to be used for. Sharpening the selection should result in a selection identical to what is visualized by the marching ants. We will fix the documentation.
2006-06-05 Sven Neumann <sven@gimp.org> * tools/pdbgen/pdb/selection.pdb: fixed documentation of gimp-selection-sharpen (bug #343911). * libgimp/gimpselection_pdb.c: regenerated.