Post Reply 

Mouse click as input to a script?

Feb 1, 2011, 16:13
Post: #1
Mouse click as input to a script?
I have a number of pictures that I am trying to rotate to make a certain rectangular subject horizontal. The easy way to do this manually is to rotate it by placing the centre of rotation on the edge that needs to be horizontal, taking into account the y coordinate of that spot, then moving another point along that edge until it is as the same y coordinate (hope that made sense; if not, see attachment).

I'm trying to write a plugin to do this with just two clicks of the mouse on the line that needs to be horizontal. The y coord of one would become the centre of rotation, the other would be used to calculate the angle of the rotation using basic trigonometry and assuming small angles (they are small enough in my application). The main hurdle is figuring out how a script can accept "click inputs", or if it's even possible.

The best solution I have so far is to create a rectangle selection before starting the plugin: its top-left corner and bottom-right corner (assuming it's tilted this \ way) would be the two points on the edge. Not very elegant, but it will work. Any better ideas?


Attached File(s) Thumbnail(s)
   
Find all posts by this user
Quote this message in a reply
Feb 5, 2011, 17:13
Post: #2
RE: Mouse click as input to a script?
You can use a path... there is a plugin ("perfect aligner" or some such") that works like that. You make a path with 4 points (two on one layer, two on the other one) and it scales/rotates/moves one layer so that the pair of points are ligned.

Now answering your questions on
https://Gimp-Forum.net
Visit this user's website Find all posts by this user
Quote this message in a reply
Feb 5, 2011, 21:06
Post: #3
RE: Mouse click as input to a script?
(Feb 5, 2011 17:13)ofnuts Wrote:  You can use a path... there is a plugin ("perfect aligner" or some such") that works like that. You make a path with 4 points (two on one layer, two on the other one) and it scales/rotates/moves one layer so that the pair of points are ligned.

Oh yeah, I never think of paths. That's not a bad idea at all! Thanks!
Find all posts by this user
Quote this message in a reply
Post Reply 


Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Need help in running a gui script-fu via command line eyalzek 2 223 Oct 4, 2014 14:05
Last Post: eyalzek
  Color menuitems in script or plugin Barbie 4 378 Sep 29, 2014 09:51
Last Post: paynekj
  script-fu ok in gimp, not in commad line dominique 1 259 Sep 28, 2014 03:18
Last Post: dominique
  Script fu and Color to alpha john 4 385 Sep 20, 2014 08:46
Last Post: rich2005
  mouse coordinate as input t4u 1 233 Sep 18, 2014 17:37
Last Post: t4u

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS