我有几个图像水印。每个图像都是不同的分辨率和尺寸。我正尝试将图像大小调整为300 x 225,并在调整大小后的图像底部显示文字。一切工作正常,除了水印尺寸不一致。 原来较高分辨率的图像具有较小的水印,较低的分辨率具有很大的水印。我将文本图层添加到调整大小的图像作为水印。我想我在添加文本图层时缺少一些设置。请帮忙。photoshop javascript图像调整大小和水印
ResizeImage();
CreateWatermark();
function ResizeImage()
{
var MedWidth = UnitValue(300,"px");
var MedHeight = UnitValue(225,"px");
activeDocument.resizeImage(MedWidth,null,null,ResampleMethod.BICUBIC);
activeDocument.resizeCanvas(MedWidth,MedHeight,AnchorPosition.MIDDLECENTER);
}
function CreateWatermark()
{
var fface = "Arial-BoldMT"
var size =6
// Add a new layer in the new document
var currentDoc = activeDocument;
var artLayerRef = app.activeDocument.artLayers.add()
artLayerRef.kind = LayerKind.TEXT
textColor = new SolidColor();
textColor.rgb.red = 245;
textColor.rgb.green = 7;
textColor.rgb.blue = 7;
textItemRef = artLayerRef.textItem
textItemRef.font = fface;
textItemRef.contents = 'picture provided by landlord';
textItemRef.color = textColor;
textItemRef.size = size
textItemRef.position = new Array(currentDoc.width-200, currentDoc.height-10)
activeDocument.activeLayer.name = "watermark";
activeDocument.activeLayer.textItem.justification = Justification.LEFT;
}
我不完全确定这与JavaScript有什么关系? –
请提供您所写的任何javascript代码,否则您的问题将被关闭。 – mpm
@GeorgeMauer:Photoshop有一个[JavaScript引擎](http://www.adobe.com/devnet/photoshop/scripting.html),可让您自动执行应用中的大部分操作。 – josh3736