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
  Request for script chlebna 1 197 Sep 13, 2017 09:35
Last Post: ythgilb
  Request for script - Guillotine + Watermark sunslick 1 255 Sep 4, 2017 08:51
Last Post: ythgilb
  Script-fu: How to create new, addressable layer using gimp-floating-sel-to-layer Bertholom√§us 1 278 Aug 31, 2017 14:32
Last Post: Bertholomäus
  How to modify this script-fu? Zakary81 1 222 Aug 23, 2017 12:48
Last Post: paynekj
  Need help in running a gui script-fu via command line eyalzek 2 381 Oct 4, 2014 14:05
Last Post: eyalzek

Forum Jump:


GIMP ForumPortalArchiveContactTermsRSS