为文本添加阴影

发布于 2024-11-16 21:02:10 字数 1132 浏览 0 评论 0原文

如何使用 Photoshop 脚本添加阴影(具有定义的距离、大小等)?

当前 JS 代码

var fontSize = 14;
var fontName = "Arial-Bold"; // NB: must be postscript name of font!
// This is the colour of the text in RGB
//Click foreground colour in Photoshop, choose your colour and read off the RGB values
//these can then be entered below.
 var textColor = new SolidColor(); 
        textColor.rgb.red  = 255; 
        textColor.rgb.green =255; 
        textColor.rgb.blue = 255; 

var newTextLayer = doc.artLayers.add(); 
newTextLayer.kind = LayerKind.TEXT; 
newTextLayer.textItem.size = fontSize; 
newTextLayer.textItem.font = fontName;
newTextLayer.textItem.contents = ++Count; 
newTextLayer.textItem.color = textColor; 
newTextLayer.textItem.kind = TextType.PARAGRAPHTEXT; 
newTextLayer.textItem.height = fontSize; 
newTextLayer.textItem.width = doc.width -20;
//The line below is the text position (X Y)  IE; 10 Pixels Right 10 Pixels Down
newTextLayer.textItem.position = Array(10, 12); 
//  Can be RIGHTJUSTFIED LEFTJUSTIFIED CENTERJUSTIFIED 
newTextLayer.textItem.justification=Justification.CENTERJUSTIFIED; 

How do I add a drop shadow (with defined distance, size etc) using Photoshop scripting?

Current JS Code

var fontSize = 14;
var fontName = "Arial-Bold"; // NB: must be postscript name of font!
// This is the colour of the text in RGB
//Click foreground colour in Photoshop, choose your colour and read off the RGB values
//these can then be entered below.
 var textColor = new SolidColor(); 
        textColor.rgb.red  = 255; 
        textColor.rgb.green =255; 
        textColor.rgb.blue = 255; 

var newTextLayer = doc.artLayers.add(); 
newTextLayer.kind = LayerKind.TEXT; 
newTextLayer.textItem.size = fontSize; 
newTextLayer.textItem.font = fontName;
newTextLayer.textItem.contents = ++Count; 
newTextLayer.textItem.color = textColor; 
newTextLayer.textItem.kind = TextType.PARAGRAPHTEXT; 
newTextLayer.textItem.height = fontSize; 
newTextLayer.textItem.width = doc.width -20;
//The line below is the text position (X Y)  IE; 10 Pixels Right 10 Pixels Down
newTextLayer.textItem.position = Array(10, 12); 
//  Can be RIGHTJUSTFIED LEFTJUSTIFIED CENTERJUSTIFIED 
newTextLayer.textItem.justification=Justification.CENTERJUSTIFIED; 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长伴 2024-11-23 21:02:10

我相信没有 API 函数可以实现这一点。
您能做的最好的事情就是使用 Scriptlistner
然后它生成的代码可以在您的脚本中使用。

以下是一些与 Scriptlistner 生成的代码类似的讨论:

http://ps-scripts。 com/bb/viewtopic.php?t=586

http://ps-scripts.com/bb/viewtopic.php?t=第2207章

I believe there is no API function for this.
The best you can do is to use Scriptlistner.
The code that it generates then can be used in your script.

Here are some similar discussion with Scriptlistner-generated code:

http://ps-scripts.com/bb/viewtopic.php?t=586
or

http://ps-scripts.com/bb/viewtopic.php?t=2207

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文