PS存储文件过大

PS存储PSD和输出JPG等文件过大,是由于元数据存储占用过大造成。通过执行脚本,可删除多余元数据。

使用方法:

在PS中打开文件后,通过菜单中“文件”——“脚本”——“浏览”,选中保存的jsx文件,执行。之后再存储,文件就能恢复普通大小。
如果文件仍然过大,检查图层是否有智能对象,对智能对象进行清理更新或栅格即可。

脚本制作:

新建记事本,复制以下代码内容,保存后改后缀为.jsx

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(); 

发表评论