前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >psd的js脚本

psd的js脚本

作者头像
阿超
发布2023-07-26 15:22:43
2020
发布2023-07-26 15:22:43
举报
文章被收录于专栏:快乐阿超快乐阿超

我们可以随自己的高兴来认识这个世界,然而世界总少不了光明面和阴暗面。——歌德

今天研究了下psd的脚本

Photoshop 中的脚本

https://github.com/Adobe-CEP/CEP-Resources/tree/master/Documentation/Product specific Documentation/Photoshop Scripting

然后下载了脚本监视器插件,可以让我们在使用psd时生成对应的脚本

Downloadable plug-ins and content in Photoshop

然后解压,复制Scripting Utilties

粘贴到PS的路径下面的Plug-ins下面

重启ps即可,之后执行操作则会在桌面生成脚本文件

脚本内容:

代码语言:javascript
复制
// Copyright 2002-2007.  Adobe Systems, Incorporated.  All rights reserved.
// Create a new art layer and convert it to a text layer.
// Set its contents, size and color.

// enable double clicking from the Macintosh Finder or the Windows Explorer
#target photoshop

// in case we double clicked the file
app.bringToFront();

// debug level: 0-2 (0:disable, 1:break on error, 2:break at beginning)
// $.level = 0;
// debugger; // launch debugger on next line

var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.INCHES;
app.preferences.typeUnits = TypeUnits.POINTS;

var docRef = app.documents.add(7, 5, 72);

// suppress all dialogs
app.displayDialogs = DialogModes.NO;

var textColor = new SolidColor;
textColor.rgb.red = 255;
textColor.rgb.green = 0;
textColor.rgb.blue = 0;

var newTextLayer = docRef.artLayers.add();
newTextLayer.kind = LayerKind.TEXT;
newTextLayer.textItem.contents = "Hello, World!";
newTextLayer.textItem.position = Array(0.75, 0.75);
newTextLayer.textItem.size = 36;
newTextLayer.textItem.color = textColor;

app.preferences.rulerUnits = strtRulerUnits;
app.preferences.typeUnits = strtTypeUnits;
docRef = null;
textColor = null;
newTextLayer = null;

执行结果

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2023-07-24,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档