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
  Run script on action rchav 2 1,225 Aug 13, 2018 14:57
Last Post: rchav
  Script Fu Errors Gimp 2.10.4 lightsaber jd3481 1 798 Aug 2, 2018 05:13
Last Post: paynekj
  Script-fu script to conversion pdf to image 4ever 12 14,082 Jul 17, 2018 16:01
Last Post: paynekj
  Problems with a bat script :( ThaUnknown_ 1 618 Mar 26, 2018 21:14
Last Post: paynekj
  Script-fu ordered file list vnicent 1 420 Mar 19, 2018 17:33
Last Post: paynekj

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS