GNOME Bugzilla – Bug 316212
'import palette' from image disrespects selection mask
Last modified: 2006-05-28 14:51:41 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.
I think you are correct about point 2 but I am not sure if the selection should actually be considered here.
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.
IMHO respecting the selection would make sense for "Palette from layer", but not for "Palette from image".
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.
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.
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.
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?
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.
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.