Switch to full style
Post all Gimp scripts and script writing questions here
Post a reply

Is there a direct way of getting selection value in python fu?

Sat May 14, 2016 1:48 pm

current code:
Code:
if pdb.gimp_selection_value(image,x,y) > 0:

tells if point at (x,y) is in selection or not

so is there some other python-fu method that gets this value quicker?

Re: Is there a direct way of getting selection value in python fu?

Sun May 15, 2016 4:31 am

See image.selection.get_pixel(x,y) (returns a one-element tuple, since the selection is a grayscale channel).

But if you are worried about performance, you shouldn't process the image pixel by pixel. The trick is to figure out what processing you can apply "en masse" to your layers so that the actual pixel transformations are handled by native operations.

Re: Is there a direct way of getting selection value in python fu?

Sun May 15, 2016 9:47 am

ofnuts wrote:See image.selection.get_pixel(x,y) (returns a one-element tuple, since the selection is a grayscale channel).

But if you are worried about performance, you shouldn't process the image pixel by pixel. The trick is to figure out what processing you can apply "en masse" to your layers so that the actual pixel transformations are handled by native operations.


Thanks you so much...i tried to search for this information on the internet like crazy and nothing showed up..now when i search this question and answer shows up.
The "en masse" sure is tricky alright.
Post a reply