我有一个单一的photoshop文件,和200个图像文件(png)。使用photoshop作为模式,我需要生成200个新图像,其中每个图像是放置在photoshop模式中的不同png的结果。
基本上,用我有的外部png文件替换了photoshop内部图层的图像。
它是可以使用photoshop脚本自动完成的吗?
发布于 2014-02-05 19:11:25
根据要求,我建议在photoshop中使用变量特性。菜单->图像->变量
然后只需选择要更改的层,并指定变量名,并选择“像素替换”行为。
在Photoshop之外,创建一个文本文件,其中第一行为变量名,每一行为新行。
转到菜单-> file ->import->变量数据集并浏览您的文本文件。
如果您看到了错误消息,那么一切都是正确的。
转到菜单->file->导出->数据集到文件和瞧!
发布于 2013-10-15 14:51:46
是的,使用脚本可以做到这一点。使用源映像(psd),然后加载200幅图像中的每一幅,并将其放入源文件中(然后随心所欲地执行,保存文件),切换回源文件,继续遍历图像,直到全部完成为止。
// must have source psd open to start with.
//pref pixels
app.preferences.rulerUnits = Units.PIXELS;
// call the source document
var srcDoc = app.activeDocument;
var inFolder = Folder.selectDialog("Please select folder to process");
if (inFolder != null)
{
var fileList = inFolder.getFiles(/\.(png)$/i);
}
// main loop starts here
for(var i = 0; i < fileList.length; i++)
{
// load the frames one by one
var doc = open(fileList[i]);
var tempImage = app.activeDocument.name;
//select all
activeDocument.selection.selectAll()
//copy image
activeDocument.selection.copy();
//close that document without saving
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
// select the source image
activeDocument = srcDoc;
getMeThisLayer("my favourite layer")
//paste
app.activeDocument.paste();
//deselect all
activeDocument.selection.deselect()
var filePath = srcDoc.path + "/" + tempImage;
// Flatten the image
activeDocument.flatten();
// save out the image
var pngFile = new File(filePath);
pngSaveOptions = new PNGSaveOptions();
pngSaveOptions.embedColorProfile = true;
pngSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
pngSaveOptions.matte = MatteType.NONE; pngSaveOptions.quality = 1;
activeDocument.saveAs(pngFile, pngSaveOptions, false, Extension.LOWERCASE);
// close that save png
app.activeDocument.close()
}
function getMeThisLayer(aLayerName)
{
try
{
// try to find the layer
app.activeDocument.activeLayer = app.activeDocument.layers.getByName(aLayerName)
return
}
catch(e)
{
//Whoops can't find layer
alert("Can't find layer " + aLayerName + "\n" + e)
}
}玩得开心。
https://stackoverflow.com/questions/19379449
复制相似问题