Sub topic 6
Swapping Designs with Replace Contents
Assume you know how to select layers, work with layer groups and masks, and recognize a smart object layer. This chapter shows how to replace a mockup design without rebuilding its perspective, masks, blend modes, or effects.
Why Replace Contents works
A smart object stores source artwork separately from the mockup scene. The mockup layer stores the placement and appearance of that artwork. Replace Contents changes the source artwork while keeping the smart object layer's existing settings.
This is useful when one product scene must display many designs. For example, a package mockup can keep its perspective transform, layer mask, shadow, and highlight layers while you test several labels.
Replace a design in the Photoshop interface
Before replacing the file, save the mockup as a layered Photoshop document. Keep the original placeholder file somewhere safe if you may need it again.
- In the Layers panel, select the placeholder smart object. Confirm that its thumbnail has the smart object badge.
- Choose Layer > Smart Objects > Replace Contents.
- Select the new artwork file and choose Place or Open, depending on your Photoshop version.
- Wait for Photoshop to update the canvas. The new design should appear in the same position as the old one.
- Inspect the edges, mask, shadows, and highlights at 100% zoom.
- Save the mockup with a new filename so the original scene remains unchanged.
The new file should usually have the same canvas dimensions and orientation as the original smart object contents. A different aspect ratio can leave empty areas or place important artwork outside the visible mask.
| Result | Likely cause | Fix |
|---|---|---|
| Replace Contents is unavailable | The selected layer is not a smart object | Select the correct placeholder layer |
| Artwork appears cropped | The new source has a different canvas size | Edit the source canvas or reposition the artwork |
| Perspective is still correct but the design looks too large | The replacement artwork uses different internal margins | Open the smart object and scale the artwork inside it |
| Shadows disappear | The shadows were inside the replaced smart object | Move them outside the smart object or recreate them in the scene |
> callout warning > Replace Contents preserves the smart object's layer-level transform and effects. It does not guarantee that two source files have matching artwork placement inside their canvases.
Check the replacement
Double-click the smart object thumbnail to inspect its contents. If the design is not aligned, use Edit > Free Transform inside the smart object. Save that document, then return to the mockup. Photoshop updates the parent document automatically.
For repeated work, a script can replace a named top-level smart object and save a JPEG copy:
#target photoshop
var doc = app.activeDocument;
var artworkFile = new File("~/mockups/art/poster-01.png");
var outFile = new File("~/mockups/out/poster-01.jpg");
doc.activeLayer = doc.layers.getByName("Artwork");
var desc = new ActionDescriptor();
desc.putPath(charIDToTypeID("null"), artworkFile);
desc.putInteger(charIDToTypeID("PgNm"), 1);
executeAction(
stringIDToTypeID("placedLayerReplaceContents"),
desc,
DialogModes.NO
);
var options = new JPEGSaveOptions();
options.quality = 10;
doc.saveAs(outFile, options, true, Extension.LOWERCASE);The script expects a top-level layer named Artwork. Test it on a copy before processing many files.
Exercise
Why can a replacement have the correct perspective but still look misaligned?
Show answer
Replace Contents keeps the smart object's transform, but the new file may have different dimensions or internal margins. Align the artwork inside the smart object contents.