admin

photoshop优化psd文件大小的脚本
function deleteDocumentAncestorsMetadata() { whatApp ...
扫描右侧二维码阅读全文
27
2024/05

photoshop优化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("There are no open documents. Please open a file to run this script.")
        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();
         }
}
//Now run the function to remove the document ancestors
deleteDocumentAncestorsMetadata();

安装教程:电脑新建文本文档-以上代码复制进去保存-文件后缀名改为.Jsx

使用方法:

打开PSD文件-先择菜单栏的文件-脚本-浏览;
选择保存的.Jsx文件-点击载入;
等待自动处理完成,时间与文件大小和电脑配置有关,一般都需要几秒~几分钟;
完成后保存就可以看到文件变小啦,还不快快用起来。
github直接下载脚本:
https://github.com/MarshySwamp/deleteDocumentAncestorsMetadata

参考网页:https://zhuanlan.zhihu.com/p/354033249

Last modification:May 27th, 2024 at 03:13 pm
如果觉得我的文章对你有用,请随意赞赏

Leave a Comment