我不确定这是AppleScript的东西,还是在实际语言中会更好(Photoshop记录动作很糟糕),但我想知道Photoshop中是否有办法:
答案 0 :(得分:0)
通常Stack Overflow就是提问和获得答案。莫尔索,如果你已经努力尝试自己解决问题;不是满足要求。但是既然你指出编写你的想法而不是运行一个我已经为你写过基础知识的动作是有益的。也许你可以选择并运行它。
首先,有三种语言可以编写Photoshop脚本。它们是 Apple脚本, JavaScript 和 Visual Basic 。虽然VB是极少数。 JavaScript是首选武器。
这是一个JavaScript,可以移动水印并保存现有文件。 不是说通过脚本进行粘贴可能有点棘手;除非您事先立即剪切或复制图像,否则它可能无效。两次粘贴似乎不起作用,因此您必须在运行脚本之前复制之前的图像。您可以更改脚本以加载到您需要的文件中,并将其放在另一个文档中:
// call the source document
var srcDoc = app.activeDocument;
//get the image with and height
var w = srcDoc.width.value;
var h = srcDoc.height.value;
// paste into current document
app.activeDocument.paste();
// set the name
srcDoc.activeLayer.name = "watermark"
// set the distance the watermark needs to move
var offsetX = 40;
var offsetY = 20;
//call the function to offset the image
moveActiveLayer(w, h, offsetX, offsetY)
//set opacity
srcDoc.activeLayer.opacity = 40
//flatten the image
srcDoc.flatten();
//save the image
app.activeDocument.close(SaveOptions.SAVECHANGES)
// function MOVE ACTIVE LAYER (layer name, deltaX, deltaY)
// ----------------------------------------------------------------
function moveActiveLayer(imageWidth, imageHeight, dX, dY)
{
var x = parseFloat(srcDoc.activeLayer.bounds[0])
var y = parseFloat(srcDoc.activeLayer.bounds[1])
var x1 = parseFloat(srcDoc.activeLayer.bounds[2])
var y1 = parseFloat(srcDoc.activeLayer.bounds[3])
var moveX = (imageWidth - x1) - dX;
var moveY = (imageHeight- y1) - dY;
// coords from bottom right
// Transform layer
// =======================================================
var id442 = charIDToTypeID( "Trnf" );
var desc93 = new ActionDescriptor();
var id443 = charIDToTypeID( "null" );
var ref64 = new ActionReference();
var id444 = charIDToTypeID( "Lyr " );
var id445 = charIDToTypeID( "Ordn" );
var id446 = charIDToTypeID( "Trgt" );
ref64.putEnumerated( id444, id445, id446 );
desc93.putReference( id443, ref64 );
var id447 = charIDToTypeID( "FTcs" );
var id448 = charIDToTypeID( "QCSt" );
var id449 = charIDToTypeID( "Qcsa" );
desc93.putEnumerated( id447, id448, id449 );
var id450 = charIDToTypeID( "Ofst" );
var desc94 = new ActionDescriptor();
var id451 = charIDToTypeID( "Hrzn" );
var id452 = charIDToTypeID( "#Pxl" );
desc94.putUnitDouble( id451, id452, moveX );
var id453 = charIDToTypeID( "Vrtc" );
var id454 = charIDToTypeID( "#Pxl" );
desc94.putUnitDouble( id453, id454, moveY );
var id455 = charIDToTypeID( "Ofst" );
desc93.putObject( id450, id455, desc94 );
executeAction( id442, desc93, DialogModes.NO );
}