It is currently Thu Jul 04, 2024 4:57 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Is there a direct way of getting selection value in python fu?
PostPosted: Sat May 14, 2016 1:48 pm  (#1) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4003
Location: Canada
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?

_________________
TinT


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Is there a direct way of getting selection value in python fu?
PostPosted: Sun May 15, 2016 4:31 am  (#2) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4756
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.

_________________
Image


Top
 Post subject: Re: Is there a direct way of getting selection value in python fu?
PostPosted: Sun May 15, 2016 9:47 am  (#3) 
Offline
Script Coder
User avatar

Joined: May 07, 2014
Posts: 4003
Location: Canada
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.

_________________
TinT


Top
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours [ DST ]


   Similar Topics   Replies 
No new posts Convert GIMP plugin from Python 2 to Python 3

4

No new posts Difference between "Python-Fu" and "Python" plugin

6

No new posts Guides from selection

2

No new posts Alpha to Selection Help

1

No new posts Can't Alpha to Selection

5



* Login  



Powered by phpBB3 © phpBB Group