Copy link to clipboard
Copied
Image> Variable> Definition
Then, when replacing the image, the smart object will no longer be the target of the image replacement. I want to perform batch image replacement with csv after giving the angle and scale to the replacement image. Is there any way or JSX to do this?
You can most likely use scriptlistener to get the code to replace a smartobject's content then create a looped script to run through all your files or csv entries to replace the images and apply the angles.
You would need to write a script that would work like Adobe's Data Driven graphics. That supports Smart object layers and come up with some way the define smart object layers as a variable. Photoshop variable only support three types of variable layer. Text layers for replacement, normal pixels layers for image replacement. And Layers that you can control their visibility.
Data Driven Graphics does not support replacing Smart Object layers content. With Data driven graphics you can only
...Copy link to clipboard
Copied
You can most likely use scriptlistener to get the code to replace a smartobject's content then create a looped script to run through all your files or csv entries to replace the images and apply the angles.
Copy link to clipboard
Copied
Thank you for the advice. I'll try that way!
Copy link to clipboard
Copied
You would need to write a script that would work like Adobe's Data Driven graphics. That supports Smart object layers and come up with some way the define smart object layers as a variable. Photoshop variable only support three types of variable layer. Text layers for replacement, normal pixels layers for image replacement. And Layers that you can control their visibility.
Data Driven Graphics does not support replacing Smart Object layers content. With Data driven graphics you can only control smart object layer visibility.
There are also Problem replacing Smart Object Layer contents using Photoshop Scripting. There are two ways to do it.
One is to use Photoshop Feature Layer>Smart Objects>Replace Content. The replacement file must exactly like the object in the template Smart Object layer. exactly the same size, aspect ratio and print resolution. For the Smart Object Layers associated Layer Transform is not changed or updated when the object content is replaced.
Two if the replacement files are not the correct size, aspect ratio and print resolution. You can use Photoshop's feature to open Smart Object Layers Object. Then you can fit the replacement file into the existing object. You can not change the size of the object for the associated smart object layer layer's transform is not updated. There is an additional problem because all smart objects will not be opened in Photoshop. Placed vector files object will open in a vector application like AI. And place a RAW file or RAW file opened as a smart object layer will open in ACR the script would lose control and not be able do the replacement. The Script would need to bypass replacing vector objects and RAW objects if the template has those kind of objects.
I also do not know if a Script can see which layers are Photoshop defined variables. You may need a different method to define replacement layers. Like a some Layer naming convention in you template psd files.
If you want to change rotation you would need to edit the smart object layer associated transform which currently can have rotation and warping settings. I would not know how to automate modified an existing transform that has sizing warping and rotation. Photoshop's Data Driven Graphics does not support inage rotatioj
Script can read and write CSV file. I will be quite a task to develop such a jsx.
Copy link to clipboard
Copied
I learned very much. It's deep! I want to deepen my understanding!
Copy link to clipboard
Copied
In some cases using the action manager, you can edit the contents of a smart object without opening it (in particular, access the layers inside it) - unsmart script of Jaroslav Bereza
Also in the latest versions of Photoshop, a useful feature appeared - convert smart object to layers (a group is created in the document with the name of the smart object and its contents in the form of layers) - this can be done in your script in one line:
executeAction( stringIDToTypeID( "placedLayerConvertToLayers" ))
You can perform all necessary conversions and then re-save this group as a smart object:
executeAction( stringIDToTypeID( "newPlacedLayer" ))
Copy link to clipboard
Copied
That seems replace the smart object layer with other layers and it can not had distortion and smart filters. Therefore, Replace Content and Opening and Editing the object will work better. For on one of mains reason for using smart objects in templates is they have support distorting images via the smart object layer's associated transform witch includes sizing, rotation, perspective and warping. And adjustment with smart filters. Its discription even confuses me.
Also Photoshop placeLayerConvertToLayers will be like rasterize layer if you want to keep the visual effects of warping and filtering or remove all warping and filtering. You can not convert back to a simular smart object layer.
Copy link to clipboard
Copied
I looked at the Jaroslav Bereza code and saw that it is possible to use a different approach, compatible with earlier versions of Photoshop, which may be of interest to the author of the topic. This can be briefly described by the following set of menu commands:
Convert Smart Object to Linked file and save it in temp dir (if it has graphical content, that can be edited in the Photoshop environment, otherwise (if it is, for example, a vector file from AI), this command will be unavailable) -> open this file in Photoshop and work with its content as with a regular document -> close & save -> run "Embed linked" command in parent document -> delete linked file
In this case, there will be no problems with the transformation and effects and at the same time we can control the contents of the smart object (without replacing it completely)
(I think that it is worth voicing any working solution, maybe it will be useful to someone)
Find more inspiration, events, and resources on the new Adobe Community
Explore Now