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, 21:06
Post: #2
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
  Problems with a bat script :( ThaUnknown_ 1 354 Mar 26, 2018 21:14
Last Post: paynekj
  Script-fu ordered file list vnicent 1 192 Mar 19, 2018 17:33
Last Post: paynekj
  script-fu argument/parameter formats dhugg 2 311 Mar 13, 2018 00:50
Last Post: dhugg
  Vector input for polygon selection ss32 1 194 Feb 11, 2018 20:59
Last Post: paynekj
  Request for script chlebna 1 482 Sep 13, 2017 09:35
Last Post: ythgilb

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS