清除PSD文件中多余的元数据(Metadata)

有时候从网上找到一个巨大的图片模板之后,保存出来的jpg文件也会是个几百兆的大文件……原因也很简单,因为PSD文件之间互相复制粘贴会在对应文件的XMP元数据里记录下操作数据,也就是这个图像是从哪儿来的,称作Document Ancestor信息,如果有些特别常用的素材被复制粘贴修改转手过几万次,这些数据也会原封不动的保存在PSD文件中,进而被塞到保存的JPG文件中……

如果你通过文件–文件简介…–原始数据选项卡,看到一大堆的document ancestor,那就是它们的锅了。

解决方法在Adobe的论坛找到一个,一段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();

你可能感兴趣的:(PS)