PS脚本丨删除PS多余的原始数据
用PS的人可能会遇到导出的PNG图片文件非常大,尽管图片的尺寸只有几百像素,但文件可能有几十MB大小,正常的应该只有几百KB,原因之一可能就是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,就会变成PS脚本的图标
打开有问题的PSD文件,在“文件-脚本-浏览”选择保存的jsx文件,打开运行一下就行。
此时再去看原始数据应该就可以正常的大小,保存png图片也不会那么大了。
此方法百度谷歌搜素会出现有很多,搬运记录到此方便随时随地查阅。