Jump to content

Automatic layer alignment (via anchor points)


Recommended Posts

Hey guys,

 

I see that various similar questions have already be asked inside this forum. However, somehow I can't find the exact page that discusses this or the plugin I need for that matter.

I'm searching a way to automatically align one layer to another - but with included rotation. Eyeballing with a half-transparent layer is almost impossible because changing the size doesn't preserve the rotation anchor. So if my rotation is correct and I zoom, my previously aligned point isn't anymore. It's really frustrating.

A plugin should be possible or already exist, because basically it's just two linear operations after one another: select two points on each layer and the plugin aligns one layer to the other. The spirit level plugin is able to rotate an image according to a line the you have selected, so the basic principle is possible.

Any idea which plugin can do this? I can't imagine that it's not possible...

 

Greetings, Timo

Edited by Alpha23
Link to comment
Share on other sites

I don't think that there is a plugin for this since plugins don't work with more than one layer at a time.
(Exception: If one layer is loaded into the clipboard.)

 

If I understood more clearly what you are wanting to do, there might be a more effective way of doing it manually.
 

Link to comment
Share on other sites

10 hours ago, Alpha23 said:

A plugin should be possible or already exist, because basically it's just two linear operations after one another: select two points on each layer and the plugin aligns one layer to the other.

 

Nope. Plugins have access to one layer = the active one. Most plugins which need to access a second layer use the clipboard as a temporary store.

Link to comment
Share on other sites

Hm, the plugin only has to:

  1. mark first and second primary point (just store the coordinates)
  2. run plugin on active layer in a plugin window (like the Spirit Level Rotate)
  3. let the user mark the first and second secondary point while showing the stored points
  4. run to align active layer (matrices to move, zoom and rotate are easy to calculate)

If I had any coding experience, I'd give it a shot. Sadly, I don't. :( But it actually it doesn't sound that complicated to me to be honest. The spirit layer rotation code is available if you need some background.

Any ideas? Anyone up for the task? Because I think such a plugin is extremely helpful - also to others! I'm almost shocked that there apparently isn't one already available... Or did I miss it?

 

Greetings, Timo

  • Upvote 1
Link to comment
Share on other sites

You can create an additional layer on the top which just contains the rotation point.

 

For sure you can write a plugin where you can enter the points of the line from layer1 and align and rotate it against an other line on the active layer.

Or yo can create one plugin to store the line points on the clipboard and use this info in a second plugin. The second plugin will remember the info in the effect token.

 

midoras signature.gif

Link to comment
Share on other sites

Let me get this straight. You want something like this?

 

Asmem84.png

 

If it does, I will push it since it was 12 lines of codes. Though in this case, you would need to install the gmic plugin.

 

If you do need to find the original position, I can add that too.

Edited by Reptillian

G'MIC Filter Developer

Link to comment
Share on other sites

  • 1 year later...

Alright, somehow I need to come back to this, now that I got the time to.

 

Here's a mock-up of what I'm envisioning relating to the attached pictures
Step 1: choose anchor points on image 1

1.png

Step 2: choose anchor points on image 2

2.png

Step 3: let the plugin align those two points together with the layer (linear transformation through a rotation matrix on one layer only)

3.png
Example:
P1a=(731,1047), P2a=(1319,620)
P1b=(745,999), P2b=(1359,536)
The resulting zoom-rotation matrix is calculated as

(1.0281, -0,0043

-0.0098,0.8737)
(internally with more decimal places of course) and applied to the second picture. Both points are now exactly on top of each other - done.

I don't know how to write plugins but it doesn't strike me as particularly complicated...

 

 

 

 

Edited by Alpha23
Link to comment
Share on other sites

Why not lower the opacity of the top layer and eyeball it? This took less than a minute....

 

Overlay-alignment.png

  • Like 2
Link to comment
Share on other sites

PDN 5.0 will enable G'MIC to read from all layers, so this would probably be easier to accomplish then. (in private testing, PDN 5 already has this working, and there's a private build of G'MIC that's updated to do this)

 

However, there's no automation or batch processing ...

  • Like 1

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...