Skip to main content
Participating Frequently
June 8, 2023
Question

Quick replace multiple layers with a chosen image

  • June 8, 2023
  • 8 replies
  • 5913 views

Hi all,

A relatively simple question but I'm struggling to find a sensible way to do it. Any help would be much appreciated.

 

I have lots of images, hundreds in fact, similar to the attached. I would like to swap the circles, each of which is an individual layer, with another image (a square).

Crazy utopia: some magical way to batch process this based on layer name

Real world hope: Is there a way to select a load of layers (e.g. all the circles) and then tell Photoshop to replace all of those layers with a particular image, presumably duplicated across the layers?

 

So that an image goes from this 

 

To this


Ideas and mystical voodoo spells welcome!

 

8 replies

Participant
October 29, 2023

To swap multiple layers in Photoshop, you can use the following method. While it may not be fully automated, it is more realistic in the real world:

1. **Organize Your Layers**: Make sure all your circle layers are properly named and grouped if necessary. It will make the process more manageable.

2. **Prepare Your Square Image**: Open the square image you want to replace the circles with in Photoshop. Make sure it's the correct size and resolution.

3. **Place Square Image on Top**: Drag and drop your square image onto your document with the circles. This will create a new layer with the square.

4. **Position the Square**: Use the Move Tool (V) to position the square image over one of the circles. Make sure it's properly aligned and scaled to fit the circle.

5. **Clip the Square**: Right-click on the square layer and choose "Create Clipping Mask." This will mask the square to the shape of the circle beneath it. Repeat this process for each circle.

6. **Repeat for All Circles**: You'll need to manually repeat the above steps for each circle layer. If you have many layers, this can be a bit time-consuming.

7. **Delete Circle Layers**: Once you've replaced all the circles, you can select and delete the original circle layers.

This method should achieve the desired result but may require some manual work, especially if you have a large number of layers to replace. Photoshop doesn't have a built-in automated way to batch replace layers based on layer names directly.

Keep in mind that for a more automated solution, you might need to explore scripting in Photoshop, which can be quite advanced and may require programming skills. Photoshop's batch processing capabilities are generally more geared toward actions that affect the entire image rather than layer-specific changes.

c.pfaffenbichler
Community Expert
Community Expert
June 19, 2023
quote

7. In the document with the square image, arrange the duplicated layers in the desired positions and order.

8. Once you're satisfied with the arrangement, select all the duplicated layers in the document with the square image.

I think that is what the original poster wants to avoid – manually recreating the arrangement. 

c.pfaffenbichler
Community Expert
Community Expert
June 17, 2023

I think I got a handle on rotations and flipping of the replaced Shape Layers, but as the bounds of a rotated shape (other than a square or a circle) are difficult to assess the rotation and repositioning are two steps and the script is accordingly far from fast. 

c.pfaffenbichler
Community Expert
Community Expert
June 14, 2023

@nathanf55210958 , is the issue still relevant? 

c.pfaffenbichler
Community Expert
Community Expert
June 10, 2023

It is possible to change the Shape Layers of (practically) identical Vector Masks to the selected Shape Layer, even if rotated and flipped, to instances of one Smart Object via Script. 

Once that is done one can easily change all the instances in one go (see screenshot 3). 

But transfering the rotation and flipping to those SO-instances would seem like a bother, so it only would make sense for, in this case, the circles and squares. 

Stephen Marsh
Community Expert
Community Expert
June 9, 2023

@nathanf55210958 

 

Please upload say 3 random examples of the original files and the replacement element/s.

 

Mockups don't help, the real, actual files are what is required to examine to develop a possible solution.

 

Trevor.Dennis
Community Expert
Community Expert
June 9, 2023

Are they all the same size? Are the circles all in the exact same position?

If yes, and I have not tested so can't say for sure this would work, but:...

 

  • Make a new document with the squares in the apropriate location and with transparent background.
  • Make the layer a Smart Object, and save it in a Creative Cloud Library.  You can simply drag it to the Library panel to do this.
  • Make an Action that places the Library layer at the top of the layer stack, and flattens the image.
  • Place all of the images into a folder, and use Image Processor to run through the folder, running the Action.

You'd want to save the edited images to a new location I'm thinking — just in case.

Participating Frequently
June 9, 2023

Thank you Trevor. Unfortunately there are hundres of images, each one with circles in rnadom places, that all need replacing with squares (or turning into squares, the are ellipses, if there is an action to turn every ellipse into a square, that would achieve the same thing.)

 

I'm uploading a PSD file here as requested previously. In this example, figure A has been manually changed to the result I am looking for, and the old ellipse layers are simply switched off.  I have about 300 files like this, and I'm hoping to turn every small ellipse into a small square. 

 

I've read about the creative AI being released in PS, I don't suppose that could help?

Stephen Marsh
Community Expert
Community Expert
June 8, 2023

Are you using smart objects?

Participating Frequently
June 8, 2023

Hi Stephen, 

 

Thank you for replying.  I'm not,  they are just regular layers,  but I'm not adverse to converting them if it helps

c.pfaffenbichler
Community Expert
Community Expert
June 8, 2023

If you need to switch in content at volume you should not convert to Smart Objects mid-journey – you should start with Smart Objects. 

And considering the images you might have chosen the »wrong« application altogether – looks like illustrator might have been a better choice. 

 

But it might be possible to automate the task to some degree. 

Please provide several layered sample images, at least one of them in both states (as-is and as-should-be).