After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 316212 - 'import palette' from image disrespects selection mask
'import palette' from image disrespects selection mask
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: User Interface
git master
Other All
: High minor
: 2.4
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2005-09-13 14:19 UTC by david gowers
Modified: 2006-05-28 14:51 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description david gowers 2005-09-13 14:19:10 UTC
1) selecting a section of the image and importing a palette results in a palette
which is based on the colors of the entire image
2) colors with alpha == 0 are still included in the resultant palette.

no 1 is trivial to reproduce.

steps to reproduce no.2:
 * load an image
 * add an alpha channel
 * erase all but a few pixels
 * import palette from that image

My idea of correct behaviour here is to respect both.
Comment 1 Sven Neumann 2005-09-13 15:27:48 UTC
I think you are correct about point 2 but I am not sure if the selection should
actually be considered here.
Comment 2 Sven Neumann 2005-09-13 16:01:01 UTC
2005-09-13  Sven Neumann  <sven@gimp.org>

	* app/core/gimppalette-import.c (gimp_palette_import_from_image):
	ignore transparent pixels as suggested in bug #316212.

Comment 3 Michael Natterer 2005-09-19 16:13:38 UTC
IMHO respecting the selection would make sense for "Palette from layer",
but not for "Palette from image".
Comment 4 Sven Neumann 2005-09-20 16:22:16 UTC
Oh? I fail to see why it should be respected for a layer but not for the image.
The selection is an attribute of the image after all.
Comment 5 Michael Natterer 2005-09-20 17:55:57 UTC
I don't really have a strong argument, it just "feels" wrong. All operations
which affect single layers usually respect the selection, while all operation
which affect the whole image or its structure (layer order etc.) don't.

Sure, there are exceptions from this rule, but it still feels like
the right thing to do to ignore the selection when sampling colors
from all layers.

If we did respect the selection, we would have to ignore insivible layers
and parts of layers which are out-of-image (even without selection).

IMHO the most consistent thing here would be to ignore the selection for
"Import palette from image" and to add another option "Import palette from
layer/channel", which does respect the selection if one exists, and samples
the whole drawable otherwise.
Comment 6 Sven Neumann 2005-10-07 14:47:29 UTC
2005-10-07  Sven Neumann  <sven@gimp.org>

	* app/core/gimppalette-import.[ch]: added new function
	gimp_palette_import_from_drawable(), respecting the selection as
	suggested in bug #316212.

Comment 7 Sven Neumann 2005-10-07 15:37:05 UTC
Should we really add a combo-box that allows to choose from all layers/channels
or should this rather belong somehow to the image selector? There could be radio
buttons below the image combo-box:

  [x] Sample Merged, [ ] Sample from active layer

Not sure about this. Perhaps someone has a better idea?
Comment 8 weskaggs 2006-05-21 18:28:09 UTC
Raising priority to High because, now that the infrastructure has been created, it would be nice to finish this for 2.4.  If that is too hard, it should be bumped and prioritized back down.
Comment 9 Michael Natterer 2006-05-28 14:51:41 UTC
Fixed in CVS:

2006-05-28  Michael Natterer  <mitch@gimp.org>

	* app/core/gimppalette-import.[ch]: added support for extracting
	colors from the selected pixels only.

	* app/dialogs/palette-import-dialog.c: added "Sample merged" and
	"Selected Pixels only" toggles. Fixes bug #316212. Cleaned up the
	code quite a bit.