photoshop - 如何在事件文档中加载图像? (Photoshop 脚本)

标签 photoshop photoshop-script

我是 Photoshop 脚本的新手。

我想将图像图像(从我的硬盘)作为带有定位的新图层加载到事件文档中。如何才能做到这一点?有人可以分享代码吗?

谢谢

最佳答案

您可以打开 Photoshop 文件对话框来搜索图像并将其添加到图层中

file = app.openDialog();//opens dialog,choose one image

if(file[0]){ //if you have chosen an image
   app.load(file[0]); //load it into documents
   backFile= app.activeDocument; //prepare your image layer as active document
   backFile.resizeImage(width,height); //resize image into given size i.e 640x480
   backFile.selection.selectAll();
   backFile.selection.copy(); //copy image into clipboard
   backFile.close(SaveOptions.DONOTSAVECHANGES); //close image without saving changes
   doc.paste(); //paste selection into your document
   doc.layers[0].name = "BackgroundImage"; //set your layer's name
}

有一个使用 photoshop javascript 扩展 (.jsx) 制作日历的好例子。

请检查 here

关于photoshop - 如何在事件文档中加载图像? (Photoshop 脚本),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2718443/

相关文章:

javascript - 从当前位置相对移动选择

javascript - 创建 csv 并使用 Photoshop 脚本写入它

html - 创建背景斜体阴影

html - "Pros"是如何设计和编码网站的?

javascript - 调整 photoshop 智能对象 JavaScript

javascript - Photoshop 脚本 : iterating list of all layers withing the layerset is very slow

javascript - Photoshop 脚本换行符

flash - 从 Photoshop 到 Flash 具有透明度的 PNG : how to make . swf 显示 .psd 究竟是做什么的?

matlab - 复制 Photoshop sRGB 到 LAB 的转换