Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to test if there is a selection.
#1
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.
Reply
#2
I would have thought gimp-selection-is-empty would be the one to use
Reply
#3
(10-02-2020, 04:07 PM)Kevin Wrote: I would have thought gimp-selection-is-empty would be the one to use

Same here.
Reply
#4
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.
Reply
#5
(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.
Reply


Forum Jump: