使用Photoshop做图时,会因为某些下载的元素污染数据造成储存的PSD文件虚大,并且影响PS的运行速度,下面我们就来解决这一问题!
千万记得尝试解决前,务必做好备份!!!!
使用方法 /
①将下面这段代码复制粘贴到文本工具当中,另存为 Jsx 格式文件。再 PS 打开有问题的文档,「 文件」——「 脚本」——「 浏览…」选择保存的 Jsx 格式文件即可解决。
②下载我已制作好的Jsx文件然后按方式①执行脚本。
function deleteDocumentAncestorsMetadata() {
if(String(app.name).search(“Photoshop”) > 0) {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);
xmp.deleteProperty(XMPConst.NS_PHOTOSHOP, “DocumentAncestors”);
app.activeDocument.xmpMetadata.rawData = xmp.serialize();clearDocumentAncestorsForAllLayers(app.activeDocument);
if (app.activeDocument !== mainDocument) {
app.activeDocument.close(SaveOptions.SAVECHANGES);
}else{
app.activeDocument.save();
}
}
}function clearDocumentAncestorsForAllLayers(doc) {
try {if (doc == undefined) {
return;
}for (var i = 0; i < doc.layers.length; i++) {
var curLayer = doc.layers[i];
if (curLayer.typename != “ArtLayer”) {
clearDocumentAncestorsForAllLayers(curLayer);
continue;
}if (curLayer.kind == “LayerKind.SMARTOBJECT”) {
app.activeDocument.activeLayer = curLayer;
var idplacedLayerEditContents = stringIDToTypeID(“placedLayerEditContents”);
var actionDescriptor = new ActionDescriptor();
executeAction(idplacedLayerEditContents, actionDescriptor, DialogModes.NO);if(app.activeDocument.activeLayer == curLayer){
continue;
}
deleteDocumentAncestorsMetadata()
layerSetStr += (“\n”+curLayer.name)}
}
} catch (e) {
alert(“Layer clean fail.name=”+doc+”;e=”+e)
}
}var layerSetStr = “”;
var mainDocument = app.activeDocument;
function start(){
deleteDocumentAncestorsMetadata();
alert(“Clean finished.\n[doc name]:”+mainDocument.name+”\n[layer set]:”+layerSetStr);
}try{
if(confirm(“Start to clean?”)){
start();
}
} catch (e) {
alert(“Clean fail.e=”+e)
}
本文解决方案来源:https://github.com/julysohu/photoshop_deep_cleaner
1.本站大部分文章版权属于其合法持有人,本站仅作展示。如若本站内容侵犯了原著者的合法权益,请发送邮件至:admin@ucshe.com,我们将第一时间处理!
2.资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。
3.所有文章仅限于参考和学习,版权归原作者所有,更多请阅读免责声明。
感谢大神,超级神器!衷心感谢!
很棒,优秀 ✗微笑✗ ✗微笑✗