GIMP Chat
http://gimpchat.com/

Is there a direct way of getting selection value in python fu?
http://gimpchat.com/viewtopic.php?f=9&t=14081
Page 1 of 1

Author:  trandoductin [ Sat May 14, 2016 1:48 pm ]
Post subject:  Is there a direct way of getting selection value in python fu?

current 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?

Author:  ofnuts [ Sun May 15, 2016 4:31 am ]
Post subject:  Re: Is there a direct way of getting selection value in python fu?

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.

Author:  trandoductin [ Sun May 15, 2016 9:47 am ]
Post subject:  Re: Is there a direct way of getting selection value in python fu?

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.

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/