admin管理员组

文章数量:1536098

Photoshop怎么去掉元数据?

有一些PSD文件,明明图片宽高像素不大,文件却很大,使用photoshop软件编辑时电脑“卡渣飞”了,查看元数据后发现元数据很多,这些元数据就是“元凶”,那么如何去掉元数据呢?

  1. 将下面这段代码复制粘贴到文本工具当中,另存为后缀名为Jsx 格式文件,比如“PSD瘦身.jsx”。
  2. 然后PS打开有元数据的PSD文件,执行「 文件」——「 脚本」——「 浏览…」,选择保存的 Jsx 格式文件“PSD瘦身.jsx”,即可解决该问题。

代码如下:

function deleteDocumentAncestorsMetadata() {
	
	//String version of the app name
	whatApp = String(app.name);
	
	// Check for photoshop specifically, or this will cause errors
	if(whatApp.search("Photoshop") > 0) { 

		// 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