Skip to main content
Participant
September 1, 2023
Answered

Transform multiple layers to exact same x, y, width, and height

  • September 1, 2023
  • 1 reply
  • 758 views

By using the transform panel, you can select multiple layers and change their x, y, width and height at the same time.

However, when adjusting the x position, for example, instead of setting each of the layers to that x position, it takes the amount that is offset by the top layer and offsets all of the layers by that amount.

Is there away to specifically specify that all of the selected layers need to go to this exact location with this exact width and height?

Thanks 

This topic has been closed for replies.
Correct answer Kurt Gold

Hi, thanks for the reply!

 

I see how the align pallete with key object can translate them easily.

The rectangle properties pallete can be used to choose each rectangles dimension.

However, I also wanted rto be able to do this with image layers. In this case, you cannot use the rectangle properties to choose their dimensions.

 

I attached a new file. It would be great to see a way to non-manually resize the dimensions of these cards to those of the green card.

Thanks!


This snippet from Muchacho should do it.

 

mySelection = activeDocument.selection;
if (mySelection.length>0){
if (mySelection instanceof Array) {
 goal=mySelection[mySelection.length-1];
 for (i=0; i<(mySelection.length-1); i++){
  ratioW = 100/(mySelection[i].width/goal.width);
  ratioH = 100/(mySelection[i].height/goal.height);
  mySelection[i].resize(ratioW,ratioH)
 }
}
}else{
 alert("Nothing selected!")
}

 

Instruction:

 

- Make sure that the reference object with the desired dimensions is located at the bottom of the stacking order.
- Select all images.
- Run the script.

 

1 reply

Kurt Gold
Community Expert
Community Expert
September 1, 2023

I think that there is a way.

 

Can you share a sample Illustrator file with instructions?

 

Participant
September 1, 2023

Sure, make all of the rectangles in this file be same dimensions and location (perfectly overlap) the yellow square.

Kurt Gold
Community Expert
Community Expert
September 2, 2023

As per your sample file you can unify the dimensions of the (live) rectangle shapes in the Transform palette. Select all and set the dimensions in the rectangle properties section according to the size of the yellow square.

 

As for the location, you may use the Align palette, setting the yellow square as the key object. That is, select all, click on the yellow square to make it the key object, then use the desired Align buttons in the Align palette.