Sub topic 14
Troubleshooting common smart object problems
This chapter assumes you have built a mockup with a named placeholder smart object. It also assumes you know how Edit Contents, Replace Contents and embedded versus linked smart objects work. Most smart object failures come from a small set of causes: a missing save, a mismatch between artwork and placeholder, a broken file link, or a wrong assumption about what a smart object allows. The sections below go through the symptoms, then the fixes.
A method for diagnosing problems
Start with what you see, then narrow it down. Most problems fall into one of four groups: the scene does not update, the artwork looks wrong, the layer will not let you do something, or a script fails.
The scene does not update after editing
You open the placeholder with Edit Contents, change the design, and the mockup stays the same.
- You did not save the contents tab. The placeholder opens in its own tab. The mockup updates only when you save that tab with File > Save (Ctrl+S or Cmd+S). Switching tabs does not update anything. Do not use Save As. It creates a separate file and breaks the connection to the mockup.
- You closed the tab and chose Don't Save. The edit is gone. Reopen the contents and redo it.
- You edited a duplicate. Photoshop has two kinds of duplicate. Duplicate Layer makes a second layer that shares the same contents, so editing one changes both. New Smart Object via Copy makes an independent copy with its own contents. If an edit changed a layer you did not intend, or failed to change the one you expected, check which kind of copy you made.
- The contents are linked and the file changed on disk. A linked smart object reads an external file. If you saved over that file from another program, use Layer > Smart Objects > Update Modified Content. Photoshop normally prompts you when it notices the change.
The linked file is missing
A linked smart object that cannot find its file shows a warning badge in the Layers panel. The badge is a red question mark or an exclamation mark, depending on your version. The usual causes are a moved or renamed folder, a different drive letter, or a mockup file copied to a colleague without the artwork.
To fix it, select the layer and choose Layer > Smart Objects > Relink to File. Pick the new location. Use Properties panel > Content to see the path Photoshop expects. If you send mockups to other people, either use embedded smart objects or package the linked files with Layer > Smart Objects > Convert to Embedded first.
The artwork looks blurry
Blur has two common sources: low resolution and repeated scaling.
- The artwork is smaller than the placeholder. Photoshop scales it up to fill the placeholder, and the pixels become soft. Open the placeholder contents and check the canvas size. If the placeholder document is 2000 px wide and your artwork is 800 px wide, you see a 2.5x enlargement. Use larger artwork or vector artwork.
- The placeholder is small and the mockup is large. The smart object retains the original data, so scaling the smart object down and back up loses nothing. But if you resize the contents document itself, you permanently change the pixels inside it.
- You rasterized the layer. Layer > Rasterize destroys the link to the original pixels. Undo it, or rebuild the placeholder.
The artwork is the wrong size or position after Replace Contents
Replace Contents places the new file inside the existing bounds of the old one. If the new artwork has a different aspect ratio, it is fitted to those bounds, so you can see unexpected gaps or cropping. The transform on the smart object, such as perspective or warp, is kept. The contents are replaced under it.
To avoid this, make every design file the same canvas size and aspect ratio as the placeholder contents. Chapter 5 covered sizing. If you cannot control the sizes, open the placeholder after replacing, and adjust the artwork layer inside it.
Colors shift between artwork and mockup
A color shift usually means the artwork and mockup use different color profiles, or the artwork is in a different color mode.
- Check the profile of the mockup under Edit > Color Settings, or in the document info at the bottom of the window.
- Open the artwork and check its profile. A CMYK or Display P3 file in an sRGB mockup will look different.
- Convert the artwork with Edit > Convert to Profile before placing it. Do not use Assign Profile unless you know the profile tag was wrong, because Assign changes the look instead of preserving it.
Also check the smart object's own bit depth. An 8-bit mockup with 16-bit artwork is converted on the way in. This is usually fine, but gradients can show banding.
Actions are blocked or grayed out
| Message or symptom | Cause | Fix |
|---|---|---|
| "Could not complete your request because the smart object is not directly editable" | You tried to paint, erase, or clone on the layer directly | Edit the contents, or paint on a new layer above and clip it |
| Edit Contents is unavailable | More than one layer is selected | Select one smart object layer |
| Image > Adjustments are grayed out | Adjustments change pixels, which a smart object does not expose | Use an adjustment layer clipped to the smart object |
| Filter does not stay editable | The layer is not a smart object, or you rasterized it | Convert to Smart Object before applying the filter |
| Layer stays in the old position when you move a group | The layer is linked to another layer | Check the link icon in the Layers panel |
Smart filters apply to the whole smart object, and they run each time the content changes. A heavy filter such as a large blur can make the document slow. Hide the filter with its eye icon while you work, then show it for the final export.
File size and speed
An embedded smart object stores a full copy of its contents inside the mockup file. Many embedded copies of a large image can push a PSD past a gigabyte and make saving slow. Options:
- Use linked smart objects for large photographs.
- Use Duplicate Layer when the copies should share contents, so the data is stored once.
- Keep the placeholder contents no larger than you need.
- Purge memory with Edit > Purge > All if Photoshop becomes sluggish.
Script problems
The Replace Contents script from the previous chapter assumes a top-level layer and an existing file. These are the three most common failures.
getByNamethrows an error.doc.layers.getByNamesearches only the top level. If the placeholder is in a group, you must search the group'slayerscollection. A recursive search handles any depth.- The layer is not a smart object.
executeActionwithplacedLayerReplaceContentsfails on an ordinary layer. Checklayer.kind. - The artwork file does not exist.
~expands to your home folder, so the path differs on each machine. TestFile.existsbefore running the action.
This version handles all three cases:
#target photoshop
function findLayer(container, name) {
for (var i = 0; i < container.layers.length; i++) {
var layer = container.layers[i];
if (layer.name === name) {
return layer;
}
if (layer.typename === "LayerSet") {
var found = findLayer(layer, name);
if (found) {
return found;
}
}
}
return null;
}
var doc = app.activeDocument;
var artworkFile = new File("~/mockups/art/poster-01.png");
if (!artworkFile.exists) {
$.writeln("Missing artwork: " + artworkFile.fsName);
} else {
var target = findLayer(doc, "Artwork");
if (target === null) {
$.writeln("No layer named Artwork was found.");
} else if (target.kind !== LayerKind.SMARTOBJECT) {
$.writeln("Artwork exists but is not a smart object.");
} else {
doc.activeLayer = target;
var desc = new ActionDescriptor();
desc.putPath(charIDToTypeID("null"), artworkFile);
desc.putInteger(charIDToTypeID("PgNm"), 1);
executeAction(stringIDToTypeID("placedLayerReplaceContents"), desc, DialogModes.NO);
$.writeln("Replaced contents of " + target.name);
}
}A short checklist
- Did you save the contents tab with Save, not Save As?
- Is the layer still a smart object, not rasterized?
- Does the artwork match the placeholder in size, aspect ratio, and color profile?
- If the smart object is linked, does the file still exist at the stored path?
- Is only one layer selected when you use Edit Contents?
- If a script fails, is the layer inside a group, and does the artwork file exist?
Exercise
You duplicated a smart object layer with Duplicate Layer to create a second product on the mockup. You edit the contents of the second one, and the first product changes too. Why did this happen, and how do you get independent contents?
Show answer
Duplicate Layer creates a second layer that shares the same embedded contents, so an edit to one shows in both. To get independent contents, undo the duplicate and use Layer > Smart Objects > New Smart Object via Copy instead. Or, on an existing duplicate, apply that command to the layer to give it its own copy.
Exercise
A script that replaces artwork reports an error when it runs on a mockup where the "Artwork" smart object sits inside a group named "Poster". The same script works on another mockup where the layer is at the top level. What is the cause, and what two checks should the script run before calling executeAction?
Show answer
doc.layers.getByName searches only the top level, so it cannot find a layer inside a group. Search recursively through each LayerSet's layers collection. Before executeAction, the script should check that the artwork file exists (File.exists) and that the found layer's kind is LayerKind.SMARTOBJECT.