您当前的位置: 首页 > 

插件开发

暂无认证

  • 2浏览

    0关注

    492博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Adobe-Photoshop(PS)-脚本开发-去除文件臃肿脚本

插件开发 发布时间:2022-06-30 08:40:36 ,浏览量:2

文章目录
    • 1.算法程序
    • 2.作者答疑

1.算法程序

  PS是使用非常广泛的图像处理软件,被广大设计师喜爱和熟悉。由于非常广泛的用途,而PS又不可能面面俱到,所有就有基于它的各种插件开发来扩展其功能,满足其特定专业的需要。本文介绍一种常用的脚本,将臃肿的PSD文件,去除臃肿。移除菜单文件->文件简介->原始数据,下图所示: 在这里插入图片描述

  代码如下所示:

function deleteDocumentAncestorsMetadata() {
    whatApp = String(app.name); //String version of the app name
    if (whatApp.search("Photoshop") > 0) { //Check for photoshop specifically, or this will cause errors
        //Function Scrubs Document Ancestors from Files
        if (!documents.length) {
            alert("请先打开文档!")
            return;
        }
        if (ExternalObject.AdobeXMPScript == undefined)
            ExternalObject.AdobeXMPScript = new ExternalObject("lib:AdobeXMPScript");
        var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
        // Begone foul Document Ancestors!
        xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, "DocumentAncestors");
        app.activeDocument.xmpMetadata.rawData = xmp.serialize();
    }
}
//运行文档移除标注
deleteDocumentAncestorsMetadata();

  该脚本代码的主要功能是移除psd中臃肿的标记。

2.作者答疑

  如有疑问,敬请留言。

关注
打赏
1665481431
查看更多评论
立即登录/注册

微信扫码登录

0.0434s