Home

Centering Layers

When designing graphics for themes and skins in Photoshop I frequently find myself centering the contents of one layer within the contents of another layer (like nested circles). Although the steps to accomplish this are simple, rather than wading through menus one could easily create a Photoshop Action, or macro, to accomplish this feat. Here’s how I do it:

Centering one layer in another.

Requirements

  • Photoshop 6.0 and higher.
  • Layers palette is enabled and visible. If yours isn’t, then activate it from the menu by selecting Windows then Layers.

How to do it

  1. First, select the contents of the layer you want something centered within by Ctrl+clicking (PC) or Apple+clicking (Mac) the layer in the Layers palette. This should create a selection around whatever is on that particular layer.
    • Note: If you want to center within the entire page, then press Ctrl+A (PC) or Apple+A (Mac), which selects everything.
  2. Select the layer you want centered inside the other in the layers palette by clicking on it.
  3. Navigate through your menus Layer > Align to selection > VERTICAL Centers.
  4. Navigate through your menus Layer > Align to selection > HORIZONTAL Centers.

My Action created for Photoshop 6.0 essentially just performs steps 2-4, giving me the flexibility of choosing the are to center to before starting the action.

I’ve also set my action to be triggered by the F9 key, so I can make the selection to center in, click the layer to center, and then press F9. One could just as easily create an action to center to the entire page.

A brief example

In this example I’ve created a new Photoshop document (Ctrl/Apple+N) and set its dimensions to 140×140 pixels and set its background to white. Resolution you can leave at the default, it’s irrelevant in this example.

In this new file I’ve created two new layers (Ctrl/Apple+Shift+N) containing the following items:

  1. Layer 1, Topmost layer: A circle of 96px in diameter colored orange.
  2. Layer 2, Bottom-most layer: A circle 128px in diameter filled with a green color.

You can see in the above image that the two circles are placed kind of randomly in the image. We want to center these using the technique given above.

To vertically center the orange circle over the green one I Ctrl/Apple+clicked the layer containing the green circle. This creates a selection area based on the contents of the clicked layer, in this case, the green circle. Then I clicked on the layer containing the orange circle to activate it so when we use the menu options, this is the layer that will be moved. Now, navigating through the menus I selected the following options: Layer > Align to selection > VERTICAL Centers, giving us the following image:

Of course, I want the orange circle COMPLETELY centered within the green one. We do essentially the same thing as above, keeping the selection area based on the green circle, clicking the orange-circle containing layer, only this time we navigate to Layer > Align to selection > Horizontal Centers

That’s an easy success now, isn’t it? Let’s take it a step farther, however, to demonstrate the scope of this technique. In the steps so far we have centered a smaller object within a larger one. What about centering larger objects around a smaller one? Works exactly the same!

Below you will see that I’ve added a fuschia dot in the lower right quadrant of the image. It’s created on a new layer over both of the other two and the circle is 10px in diameter.

To center the other two circles around this little dot, perform the following steps, or use an action recorded by these steps as advised earlier.

  1. First make a selection based on the dot by Ctrl/Shift+Clicking the layer containing the dot.
  2. Then click on the layer containing the orange circle to select it as the active layer.
  3. Through the menus, navigate to Layer > Align to selection > Horizontal Centers.
  4. Similarly, navigate to Layer > Align to selection > Horizontal Centers.

The orange circle should now be centered around the fuschia dot as follows:

Execute the same steps, only in step 2, select the layer containing the green circle instead.

...and now

What others are saying.

Very usefull info Rich. Thanks for the tute.

 

Likes

Yup, that's my tumblog.

You can make your own at Tumblr.

Whatcha been doin', mrbiotech?

RSS / Atom