Help with arranging layers

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

doublehelix

Help with arranging layers

Post by doublehelix »

Hello all,
I’m hoping someone can help with a task I am trying to automate. Unfortunately I have next to zero experience with this sort of thing.
So, for a stack of layers,

(1) I want to spread the layers out horizontally using a list of values. Note that this is not the same as adding a space between the layers; the effect would be like like spreading out a deck of cards. It would be similar to the distribute-layers-horizontally function that ships with photoshop, except I want to supply a list of pixel values, one for each layer. The values would specify how much to move the layer relative to the previous layer.

For example, if I had a list that read (6, 8, 2),
layer 1 would be moved to the right by 6 px
layer 2 would be moved to the right by (6+8)px,
and layer 3 would be moved to the right by (6+8+2) px.

(2) After the layers are spread out, the canvas size should be adjusted so that they all fit.

Thanks in advance for any assistance. I really appreciate the help!
Dan

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

Help with arranging layers

Post by Mike Hale »

Do you want to 'spread' in one direction only?

You could use layer.translate() to move each layer then revealAll to expand the canvas to show the full image.
doublehelix

Help with arranging layers

Post by doublehelix »

Great, that got me started. Thanks for the quick reply.