如何使用打开的图像更新 PSD 文件链接层
我有点卡住了。我为 Photoshop 创建了一个脚本,用于打开一个 PSD 文件,其中包含几个图层和一个链接图层(类似于模板)。
到目前为止,我通过创建一个运行以下步骤和脚本的 Droplet,让事情对我有用:
- 打开删除的文件/图像。
- 打开 PSD 文件(打开模板,脚本化)。
- 更新所有智能对象(包括链接层,但受特定名称和位置限制)(非脚本化、录制的操作)。
- 将模板功能应用到之前已更新(脚本化)的链接图层。
- 保存 PNG 文件(脚本化),
- 最后关闭打开的图像和模板文档(录制的操作)。
到目前为止一切都很好。但这有一个限制。它一次只能处理特定位置、具有特定名称的一个文件。因此,例如,要使更新链接层正常工作,在本例中,图像名称必须仅在“下载”文件夹内为 1.png。
所以我的问题是:我如何编写此脚本以使用掉落到 Droplet 上的图像作为源在链接层上运行更新迭代,无论文件类型(png、jpg 等)、名称、位置如何,并索引输出保存的 PNG 文件? (1.png、2.png、3.png 等。)
I am a bit stuck. I have created a script for Photoshop that opens a PSD file containing a few layers plus a linked one, sort of a template.
So far, I got things working for me by creating a droplet that runs the following steps and scripts:
- Opening the file/image that is dropped.
- Opening the PSD file (opening template, scripted).
- Updating all smart objects (including the linked layer, but limited by a specific name and location)(not scripted, recorded action).
- Applying the template features to this linked layer which has been updated previously (scripted).
- Saves a PNG file (scripted),
- And finally, closing up opened image and template documents (recorded action).
All is good so far. But this has a limitation. It will only work on one file at a time, with a specific name, at a specific location. So, for example, for the update linked layer to work, the name of the image must be 1.png inside Downloads folder only, in this case.
So my question is: How can I script this to run an iteration of the update on the linked layer using as source(s) the images dropped onto the droplet, regardless of file types (png, jpg, etc.), name, location, and index the output saved PNG file(s)? (1.png, 2.png, 3.png, and so on.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我开始研究我的方法以及前面提到的步骤:
1 - 打开拖放到 Photoshop Droplet 上的文件/图像。
这会在文件中自动发生 - Photoshop 将打开落在液滴上的文件,从而触发所规定的特定操作序列。第一步解决了。下一个!
2 - 打开 PSD 文件(打开模板,脚本化)
通过这一步,我编写了一个打开模板文件的脚本。行动序列的第一步是这样的!
这又是一件毫不费力的事。下一个!
3 - 更新所有智能对象(包括链接层,但受特定名称和位置限制)(不是脚本化、记录操作)
我需要确保模板可以轻松找到其先前链接层位置以进行第三步的更新去工作。我知道有很多方法可以用脚本来更新它,但我不想修改它。对于现阶段的我来说,以我有限的知识来说,这实在是太麻烦了。因此,我决定满足必要的要求,以便模板能够找到一个熟悉的文件名,当触发“更新所有修改的内容”操作时,它会查找该文件名。
在此阶段,在 Photoshop 中打开两个文件,一个是用作模板新源的初始图像,第二个文件是 template.psd,其中包含需要使用模板内容进行更新的链接图层。第一个文件。
首先,我使用模板在搜索链接图层名称时要查找的名称保存了图像的副本。接下来,我使用第一个图像文件的位置保存了模板的副本,以确保初始模板免受所有这些操作的影响。第三,我触发了“更新所有修改的内容”操作。瞧,一切顺利。初始模板旁边有链接文件。因此,新的模板副本将在同一位置、文件夹/位置中搜索并找到它旁边的文件,就像在预览步骤中发生的那样,帮助保存它。
现在,四、五和六很简单:
4 - 将模板功能应用到之前刚刚更新过的链接层(脚本化)。完毕!
5 - 将新形成的模板另存为 PNG 文件(脚本化)。完毕!
6 - 最后,关闭打开的图像和模板文档(录制的操作)。完毕!
I started working on my approach, and the steps previously mentioned:
1 - Opening the file/image that is dropped onto the Photoshop droplet.
This would happen automatically with the file—Photoshop will open the file dropped onto the droplet, thus triggering the specific actions sequence set forth. Step one solved. Next!
2 - Opening the PSD file (opening template, scripted)
With this step, I wrote a script that opens the template file. The first step in the action sequence would be this!
That was another effortless one. Next!
3 - Updating all smart objects (including the linked layer, but limited by a specific name and location)(not scripted, recorded action)
I needed to ensure that the template would easily find its previously linked layer location for the update for this third step to work. I know there are ways to update this with a script, but I didn't want to tinker with that. It was too much of a hassle for me at this stage and with my limited knowledge. Therefore I've decided to accommodate the necessary so the template would find a familiar file name it would look for when the "Update all Modified Content" action is triggered.
At this stage, there are two files opened in Photoshop, one the initial image that serves as a new source for the template, and the second file the template.psd, which contains the linked layer that needs to be updated with the content of the first file.
First, I have saved a copy of the image using the name that the template would look for when searching for the linked layer's name. Next, I have saved a copy of the template using the location of the first image file to keep the initial template safe from all these actions. And third, I triggered the "Update all Modified Content" action. And voila, everything worked. The initial template had the linked file next to it. So the new template copy would search and find the file next to it, in the same place, folder/location, as it happened on the previews step that helped save it as such.
Now, four, five, and six are straightforward:
4 - Applying the template features to this linked layer which has just been updated previously (scripted). Done!
5 - Saves the newly formed template as a PNG file (scripted). Done!
6 - And finally, closing up opened image and template documents (recorded action). Done!