RSS/Atom feed Twitter
Site is read-only, email is disabled

Pixel coordinates input type for script-fu?

This discussion is connected to the gimp-developer-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

9 of 9 messages available
Toggle history

Please log in to manage your subscriptions.

Pixel coordinates input type for script-fu? Mark Lowry 01 May 05:15
  Pixel coordinates input type for script-fu? Joao S. O. Bueno Calligaris 01 May 15:05
   Pixel coordinates input type for script-fu? Mark Lowry 01 May 22:05
    Pixel coordinates input type for script-fu? Joao S. O. Bueno Calligaris 02 May 06:16
     Pixel coordinates input type for script-fu? Mark Lowry 02 May 13:38
Pixel coordinates input type for script-fu? William Skaggs 01 May 18:52
Pixel coordinates input type for script-fu? Kevin Myers 01 May 20:35
  Pixel coordinates input type for script-fu? Sven Neumann 02 May 08:14
  Pixel coordinates input type for script-fu? coolhand 02 May 12:54
Mark Lowry
2007-05-01 05:15:32 UTC (about 17 years ago)

Pixel coordinates input type for script-fu?

I'm working on a script in which it would be advantageous to use the mouse to click on an image and have the pixel coordinates captured as an input. Right now I have to manually enter the coordinates for four points, which is a tedious process.

Is there a way to capture these coordinates as inputs to a script? If not, where is the appropriate place to suggest a feature request for this?

Thanks ..... Mark

___

Joao S. O. Bueno Calligaris
2007-05-01 15:05:53 UTC (about 17 years ago)

Pixel coordinates input type for script-fu?

On Tuesday 01 May 2007 00:15, Mark Lowry wrote:

I'm working on a script in which it would be advantageous to use the mouse to click on an image and have the pixel coordinates captured as an input. Right now I have to manually enter the coordinates for four points, which is a tedious process.

Is there a way to capture these coordinates as inputs to a script? If not, where is the appropriate place to suggest a feature request for this?

Hi - no, there is no official way to do that.

What I do in my scripts is require the user to start a Path with the bezier tool before calling the script - The script then use the coordiantes of the first (or how many I want) points of this path as input coordinates. These can e read through the PDB.

js ->

Thanks ..... Mark

___

William Skaggs
2007-05-01 18:52:11 UTC (about 17 years ago)

Pixel coordinates input type for script-fu?

From: Mark Lowry

I'm working on a script in which it would be advantageous to use the mouse to click on an image and have the pixel coordinates captured as an input. Right now I have to manually enter the coordinates for four points, which is a tedious process.

Is there a way to capture these coordinates as inputs to a script? If not, where is the appropriate place to suggest a feature request for this?

GIMP Bugzilla is the place to request features, but it is often helpful to discuss them on this list first, as you are doing.

As Joao said, the functionality doesn't exist right now. I wonder if the best way to get it would be to use sample points, which you can create by Ctrl-clicking on a ruler and dragging into the image, and can even move around after they have been created, by activating the Color Picker tool and click-dragging a sample point. Sample points are a new feature, and code hasn't yet been written to allow a plug-in to request the list of sample points belonging to an image, but it would be pretty straightforward to do so.

-- Bill


______________ ______________ ______________ ______________ Sent via the CNPRC Email system at primate.ucdavis.edu

Kevin Myers
2007-05-01 20:35:37 UTC (about 17 years ago)

Pixel coordinates input type for script-fu?

As mentioned previously on this list, I would also like to develop a plug-in with similar pixel coordinate requirements. For my purposes, using the color picker would be an extremely ugly and practically unusable hack. I really need to get the coordinates directly and on the fly from the plug-in, as in click on button on plug-in's user interface to initiate pixel selection, then click in image (or preview?) to return coordinates to plug-in.

Kevin M.

----- Original Message ---

Mark Lowry
2007-05-01 22:05:30 UTC (about 17 years ago)

Pixel coordinates input type for script-fu?

--- "Joao S. O. Bueno Calligaris" wrote:

Hi - no, there is no official way to do that.

What I do in my scripts is require the user to start a Path with the
bezier tool before calling the script - The script then use the
coordiantes of the first (or how many I want) points of this path as
input coordinates. These can e read through the PDB.

js ->

I have thought about doing that and I think that is the way I will have to go. I'm confused with how to extract elements from the vector returned by gimp-path-get-points. I thought I understood that (vector-ref vector k) was the way to pull the k-1 element from the vector, but when I input (vector-ref '#(1 1 2 3 5 8 13 21) 5) I just get an errobj on vector-ref. What do I need to do to be able to extract a value from the result of
(gimp-path-get-points image path)?

___

Joao S. O. Bueno Calligaris
2007-05-02 06:16:25 UTC (about 17 years ago)

Pixel coordinates input type for script-fu?

On Tuesday 01 May 2007 17:05, Mark Lowry wrote:

--- "Joao S. O. Bueno Calligaris"

wrote:

Hi - no, there is no official way to do that.

What I do in my scripts is require the user to start a Path with the
bezier tool before calling the script - The script then use the
coordiantes of the first (or how many I want) points of this path as
input coordinates. These can e read through the PDB.

js ->

I have thought about doing that and I think that is the way I will have to go. I'm confused with how to extract elements from the vector returned by gimp-path-get-points. I thought I understood that (vector-ref vector k) was the way to pull the k-1 element from the vector, but when I input (vector-ref '#(1 1 2 3 5 8 13 21) 5) I just get an errobj on vector-ref. What do I need to do to be able to extract a value from the result of
(gimp-path-get-points image path)?

oh man.,..
2 things:
1) I do python-fu, not Scheme (script-fu) - so I have erased from my mind the esoteric ways of getting elements out of a vector or array in Scheme. btw, if your plug-in is of any complexity, unless you think your time is being well spent as you exercise your mind around how to get and use data with scheme expressions as an extra exercise, I'd suggest writting it in python. If you are on windows, that will only work witht he developemtn version of GIJMP, though. But it has the advantadge of letting you worry with your problem instead of the language _and_ your problem.

2) this very API is being obsoleted in GIMP 2.3.x - there are all new vector manipulation calls in place, that can finally deal correctly with multiple stroke vectors (not needed to fecth just one or two coordinates anyway)

In python, an interactiuve session exploring the return values might just display:

img = gimp.image_list()[0]
pdb.gimp_path_get_points (img, "a")

(1, 0, 15, (103.03428571428572, 101.01142857142861, 1.0, 104.74857142857149, 98.902857142857101, 2.0, 529.68571428571431, 102.39999999999998, 2.0, 529.48000000000002, 102.03999999999996, 1.0, 529.27428571428572, 101.67999999999995, 2.0))

v = pdb.gimp_path_get_points (img, "a") points = v[3]
points

(103.03428571428572, 101.01142857142861, 1.0, 104.74857142857149, 98.902857142857101, 2.0, 529.68571428571431, 102.39999999999998, 2.0, 529.48000000000002, 102.03999999999996, 1.0, 529.27428571428572, 101.67999999999995, 2.0)

points[0], points[1]

(103.03428571428572, 101.01142857142861)

(the ">>>" are the prompt, not part of the language)

-- Bill...could you see if it iyou can add a simple api for retrieving the sample points? I think this will bother no one at this point, it is starightforward as you said, and...we want to get 2.4 out, so it has to be done real soon.

js
->

___

Sven Neumann
2007-05-02 08:14:24 UTC (about 17 years ago)

Pixel coordinates input type for script-fu?

Hi,

On Tue, 2007-05-01 at 13:35 -0500, Kevin Myers wrote:

I really need to get the coordinates directly and on the fly from the plug-in, as in click on button on plug-in's user interface to initiate pixel selection, then click in image (or preview?) to return coordinates to plug-in.

You can do that in the plug-in's preview window.

Sven

coolhand
2007-05-02 12:54:19 UTC (about 17 years ago)

Pixel coordinates input type for script-fu?

You cou use the selection tool and get the selection or use the path tool's initial point, or create a preview window, where you can get events more directly. Other way is to associate a key binding at your plugin that catches the position of your mouse in that moment and then get the pixel value...

Mark Lowry
2007-05-02 13:38:50 UTC (about 17 years ago)

Pixel coordinates input type for script-fu?

Joao,

Thanks for the help. I figured out that "aref" works to extract a vector element, while "vector-ref" does not appear to be supported in GIMP. I ended up using a path consisting of 4 points created before running the script to get my input points and things are working nicely now. It's not the cleanest way, but it seems to be the best I can do with the tools at hand right now.

I'll have to take a look at Python ...

Thanks again ..... Mark

___