PSD文件瘦身脚本
使用PS时,尤其是从网上下载的PSD源文件,经常遇到明明图片尺寸没有多大,也没有多余图层,文件大小却非常大的情况,另存为jpg后亦巨大无比,让人摸不着头脑。
其实,这个问题只需几行代码即可解决,步骤如下:
1.将下面代码复制粘贴到文本文档然后保存,名字改为.Jsxg格式,如“PS瘦身.Jsx”;
2.打PS文件,依次点击「 文件」-「 脚本」-「 浏览...」,选择保存的“PS瘦身.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();
版权声明:大成小站原创文章,转载请注明出处。