Gimp-Forum.net

Full Version: How to test if there is a selection.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do I test to find if an image has a selection?
What I wish to do is: If image has selection, then do something.

I'm afraid that I find the descriptions in the Python console as clear as mud! Perhaps they are OK for someone who alreay knows the answer.

david.
I would have thought gimp-selection-is-empty would be the one to use
(10-02-2020, 04:07 PM)Kevin Wrote: [ -> ]I would have thought gimp-selection-is-empty would be the one to use

Same here.
Many thanks Kevin.
My problem this time was with the English! gimp_selection_is_empty implied to me that a selection existed, but contained nothing.
gimp_no_selection or gimp_selection_absent would be more self-explanatory!
david.
(10-02-2020, 10:55 PM)david Wrote: [ -> ]Many thanks Kevin.
My problem this time was with the English! gimp_selection_is_empty implied to me that a selection existed, but contained nothing.
gimp_no_selection or gimp_selection_absent would be more self-explanatory!
david.

So the call is appropriately named, because technically the selection is always here... image.selection or pdb.gimp_image_get_selection(image) will always return a channel, but you would have to use the histogram calls to determine if there are any non-zero pixels in it.