教程 发表于 2020-4-5 14:20:49

完美解决PS导出文件过大的问题

教程作者:黑亦
本篇教程和同学们分享一个小技巧,相信在PS做图当中有时会遇到PS卡顿或者提示PS导出JPG文件过大的问题,那么此时同学们都是如何做的呢?把PS关了再开启?把图片大小缩小,其实都是不是这个原因,具体如何做可以解决,通过教程我们一起来学习一下吧,说不定遇到的问题一下就解决了呢。

教程素材://www.16xx8.com/photoshop/sucai/2018/d488538.html

操作步骤:

1.

http://pic1.16xx8.com/allimg/180627/16xx8-79330-0.png


这是文件的尺寸,不大也不小



2.

http://pic1.16xx8.com/allimg/180627/16xx8-79330-1.thumb.png


导出jpg可以看到,目前一张jpg差不多42 M



3.

http://pic1.16xx8.com/allimg/180627/16xx8-79330-2.thumb.png


然后导入制作好的文件,通过脚本导入。导入后ps会卡顿一小会,等正常后文件就恢复正常了。(因为内容问题,所以我把内容覆盖掉了)



4.

http://pic1.16xx8.com/allimg/180627/16xx8-79330-3.thumb.png


最后重新导出,可以看到文件已经是370 K 了。



5.文件制作:

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 s cript.")
return;
}
if (ExternalObject.AdobeXMPs cript == undefined) ExternalObject.AdobeXMPs cript = new ExternalObject("lib:AdobeXMPs cript");
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();


用记事本粘贴以上代码后另存,后缀改为JSX,即(名字.jsx)后打开问题文件,文件-脚本-浏览-载入JSX格式文件即可。


PS:如果怕该代码文件会损坏到psd文件,可以备份使用。


同学们可以试一下,遇到的问题说不定就迎刃而解了呢。http://www.16xx8.com/1diy/imges/wxapp_2wm.jpg

青春、一个梦 发表于 2020-4-5 14:21:38

错误

悸动的心 发表于 2020-7-29 16:55:54

代码有几处错误: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();代码注意分行。
页: [1]
查看完整版本: 完美解决PS导出文件过大的问题