• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to rapidly align one layer to another by center, or simply, align by center?

Explorer ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

1. How can I simply align one layer to another by each layer's center?

There is currently:

  • Align by Horizontal Centers
  • Align by Vertical Centers

But, how do you just Align by Center? That way you don't have to select the options twice.

 

2. What is the fastest way to align one layer to another by their centers? The only method I've found so far is to drag the layer to the other one and hope it automatically finds and aligns by center, but I can't be 100% sure it works with this approach, because I have to eyeball it.

 

 

TOPICS
Actions and scripting , Windows

Views

822

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Apr 14, 2021 Apr 14, 2021

You can record an action that plays both align steps from a single run, or a script that does similar (a few more steps may be necessary). Both can be run from keyboard shortcuts or the actions panel.

 

There are also smart guides and the move tool.

Votes

Translate

Translate
Adobe
Community Expert ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

You can record an action that plays both align steps from a single run, or a script that does similar (a few more steps may be necessary). Both can be run from keyboard shortcuts or the actions panel.

 

There are also smart guides and the move tool.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Thanks.

I created an action that does both Align to Horizontal & Vertical Center. Then I assigned a function hotkey to it.

How to assign a hotkey to action: How do you assign a hotkey to a recorded action?

 

Then I assigned CTRL SHIFT Q ... and.... CTRL SHIFT 1 .... to align by horizontal center... and the other for vertical center. (Edit--> Keyboard Shortcuts--> )

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

How do you assign a hotkey to a recorded action?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Double click the blank space to the RIGHT of your recorded action.

This opens the Actions Options window.

In the function key drop down, choose a function key to use as a hotkey.

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

Or use the menu located at the upper right of the actions panel and select the action options... command (an action, not the containing parent set must be selected).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 14, 2021 Apr 14, 2021

Copy link to clipboard

Copied

To use one Layer’s position for alignment you can load its transparency as a Selection (cmd-click its icon in the Layers Panel). 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Jul 31, 2021 Jul 31, 2021

Copy link to clipboard

Copied

It would be nice if they created this function as a simple button. I use a recorded action like other have suggested but I dislike having to do that. I'm someone who likes to have fewer things recorded as history states. I know that with this particular action it's only two history states so undoing/redoing isn't much. However for something that is so simple like this it seems silly to not have a single button.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 31, 2021 Jul 31, 2021

Copy link to clipboard

Copied

It would require a script, rather than an action, if you wish to have a single history state.

 

Select two or more layers, or one layer and a select all then run the following script to align centers with a single history state:

 

/* 

Align Centers.jsx

www.ps-scripts.com/viewtopic.php?f=66&t=7036&p=35273&hilit=align+layer#p35273

www.macscripter.net/viewtopic.php?id=38890

AdLf = Align Left
AdRg = Align Right
AdCH = Align Centre Horizontal
AdTp = Align Top
AdBt = Align Bottom
AdCV = Align Centre Vertical
*/

#target photoshop

function alignLayers() {

    //Change as required
    alignSelectedLayers('AdCH');
    alignSelectedLayers('AdCV'); 

    function alignSelectedLayers(method) {
        //app.activeDocument.selection.selectAll();
        var desc = new ActionDescriptor();
        var ref = new ActionReference();
        ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
        desc.putReference(charIDToTypeID("null"), ref);
        desc.putEnumerated(charIDToTypeID("Usng"), charIDToTypeID("ADSt"), charIDToTypeID(method));
        try {
            executeAction(charIDToTypeID("Algn"), desc, DialogModes.NO);
        } catch (e) {}
        //app.activeDocument.selection.deselect();
    }
}
app.activeDocument.suspendHistory("Align Centers", "alignLayers()");

 

Or perhaps you  would prefer to have the script play an action set and action so that you have more flexibility while still retaining a single history step:

 

#target photoshop

function alignLayers() {
var actionName = "My Align Centers Action"; // Action to run
var actionSet = "My Align Set"; // Action set to run
app.doAction(actionName,actionSet);
}
app.activeDocument.suspendHistory("Align Centers", "alignLayers()");

 

A custom keyboard shortcut can be assigned to an installed script or you could record an installed or browsed script into an action.

 

Downloading and Installing Adobe Scripts

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 31, 2021 Jul 31, 2021

Copy link to clipboard

Copied

LATEST

 


@hen5FD8 wrote:

2. What is the fastest way to align one layer to another by their centers?

 


The only way I can conceive of dragging one layer onto another is if they are in different files, otherwise you would be using the layers panel.

 

To center a layer as you move it from one document into another, hold down the Shift key. Is that what you are looking for?

 

~ Jane

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines