« 上一篇下一篇 »

Photoshop怎么去掉元数据?

有一些PSD文件,明明图片宽高像素不大,文件却很大,使用photoshop软件编辑时电脑“卡渣飞”了,查看元数据后发现元数据很多,这些元数据就是“元凶”,因为PSD文件之间互相复制粘贴会在对应文件的XMP元数据里记录下操作数据,也就是这个图像是从哪儿来的,称作Document Ancestor信息,如果有些特别常用的素材被复制粘贴修改转手过几万次,这些数据也会原封不动的保存在PSD文件中,进而被塞到保存的JPG文件中……那么如何去掉元数据呢?

将下面这段代码复制粘贴到文本工具当中,另存为后缀名为Jsx 格式文件,比如“PSD瘦身.jsx”。

然后PS打开有元数据的PSD文件,执行「 文件」——「 脚本」——「 浏览…」,选择保存的 Jsx 格式文件“PSD瘦身.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();