300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > Photoshop插件-修复高光-脚本开发-PS插件

Photoshop插件-修复高光-脚本开发-PS插件

时间:2023-05-16 19:03:41

相关推荐

Photoshop插件-修复高光-脚本开发-PS插件

文章目录

1.插件界面2.关键代码-修复高光3.代码转执行4.作者答疑

PS是一款栅格图像编辑软件,模块众多。提供了脚本,动态连接库等多种扩展机制,本文演示如何通过脚本实现修复高光相关功能,展示从互联网收集而来的一个小插件,供大家学习交流,请勿用于商业用途。

1.插件界面

本文界面是一系列功能的一部分,将逐步展示,但是功能界面是共同的,如下图所示:

2.关键代码-修复高光

大家可通过源代码阅读,来掌握相关技巧,源代码如下:

cTID = function (s) {return app.charIDToTypeID(s);};sTID = function (s) {return app.stringIDToTypeID(s);};$._ext_002 = {run: function MattifierPowder() {// Makefunction step1(enabled, withDialog) {if (enabled != undefined && !enabled)return;var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);var desc1 = new ActionDescriptor();var ref1 = new ActionReference();ref1.putClass(sTID("contentLayer"));desc1.putReference(cTID('null'), ref1);var desc2 = new ActionDescriptor();var desc3 = new ActionDescriptor();var desc4 = new ActionDescriptor();desc4.putDouble(cTID('Rd '), 221.000518798828);desc4.putDouble(cTID('Grn '), 161.001434326172);desc4.putDouble(cTID('Bl '), 129.001922607422);desc3.putObject(cTID('Clr '), sTID("RGBColor"), desc4);desc2.putObject(cTID('Type'), sTID("solidColorLayer"), desc3);desc1.putObject(cTID('Usng'), sTID("contentLayer"), desc2);executeAction(cTID('Mk '), desc1, dialogMode);};// Setfunction step2(enabled, withDialog) {if (enabled != undefined && !enabled)return;var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);var desc1 = new ActionDescriptor();var ref1 = new ActionReference();ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));desc1.putReference(cTID('null'), ref1);var desc2 = new ActionDescriptor();desc2.putString(cTID('Nm '), "Skin Color");desc1.putObject(cTID('T '), cTID('Lyr '), desc2);executeAction(cTID('setd'), desc1, dialogMode);};// Setfunction step3(enabled, withDialog) {if (enabled != undefined && !enabled)return;var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);var desc1 = new ActionDescriptor();var ref1 = new ActionReference();ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));desc1.putReference(cTID('null'), ref1);var desc2 = new ActionDescriptor();var list1 = new ActionList();var desc3 = new ActionDescriptor();var ref2 = new ActionReference();ref2.putEnumerated(cTID('Chnl'), cTID('Chnl'), cTID('Gry '));desc3.putReference(cTID('Chnl'), ref2);desc3.putInteger(cTID('SrcB'), 0);desc3.putInteger(cTID('Srcl'), 0);desc3.putInteger(cTID('SrcW'), 255);desc3.putInteger(cTID('Srcm'), 255);desc3.putInteger(cTID('DstB'), 125);desc3.putInteger(cTID('Dstl'), 255);desc3.putInteger(cTID('DstW'), 255);desc3.putInteger(cTID('Dstt'), 255);list1.putObject(cTID('Blnd'), desc3);desc2.putList(cTID('Blnd'), list1);var desc4 = new ActionDescriptor();desc4.putUnitDouble(cTID('Scl '), cTID('#Prc'), 416.666666666667);desc2.putObject(cTID('Lefx'), cTID('Lefx'), desc4);desc1.putObject(cTID('T '), cTID('Lyr '), desc2);executeAction(cTID('setd'), desc1, dialogMode);};// Makefunction step4(enabled, withDialog) {if (enabled != undefined && !enabled)return;var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);var desc1 = new ActionDescriptor();var ref1 = new ActionReference();ref1.putClass(sTID("layerSection"));desc1.putReference(cTID('null'), ref1);var ref2 = new ActionReference();ref2.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));desc1.putReference(cTID('From'), ref2);executeAction(cTID('Mk '), desc1, dialogMode);};// Setfunction step5(enabled, withDialog) {if (enabled != undefined && !enabled)return;var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);var desc1 = new ActionDescriptor();var ref1 = new ActionReference();ref1.putEnumerated(cTID('Lyr '), cTID('Ordn'), cTID('Trgt'));desc1.putReference(cTID('null'), ref1);var desc2 = new ActionDescriptor();desc2.putString(cTID('Nm '), "Mattifier Powder");desc1.putObject(cTID('T '), cTID('Lyr '), desc2);executeAction(cTID('setd'), desc1, dialogMode);};// Makefunction step6(enabled, withDialog) {if (enabled != undefined && !enabled)return;var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);var desc1 = new ActionDescriptor();desc1.putClass(cTID('Nw '), cTID('Chnl'));var ref1 = new ActionReference();ref1.putEnumerated(cTID('Chnl'), cTID('Chnl'), cTID('Msk '));desc1.putReference(cTID('At '), ref1);desc1.putEnumerated(cTID('Usng'), cTID('UsrM'), cTID('HdAl'));executeAction(cTID('Mk '), desc1, dialogMode);};// Selectfunction step7(enabled, withDialog) {if (enabled != undefined && !enabled)return;var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);var desc1 = new ActionDescriptor();var ref1 = new ActionReference();ref1.putClass(cTID('PbTl'));desc1.putReference(cTID('null'), ref1);executeAction(cTID('slct'), desc1, dialogMode);};// Setfunction step8(enabled, withDialog) {if (enabled != undefined && !enabled)return;var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);var desc1 = new ActionDescriptor();var ref1 = new ActionReference();ref1.putProperty(cTID('Clr '), cTID('FrgC'));desc1.putReference(cTID('null'), ref1);var desc2 = new ActionDescriptor();desc2.putUnitDouble(cTID('H '), cTID('#Ang'), 0);desc2.putDouble(cTID('Strt'), 0);desc2.putDouble(cTID('Brgh'), 100);desc1.putObject(cTID('T '), cTID('HSBC'), desc2);desc1.putString(cTID('Srce'), "photoshopPicker");executeAction(cTID('setd'), desc1, dialogMode);};// Setfunction step9(enabled, withDialog) {if (enabled != undefined && !enabled)return;var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);var desc1 = new ActionDescriptor();var ref1 = new ActionReference();ref1.putProperty(cTID('Clr '), cTID('BckC'));desc1.putReference(cTID('null'), ref1);var desc2 = new ActionDescriptor();desc2.putUnitDouble(cTID('H '), cTID('#Ang'), 0);desc2.putDouble(cTID('Strt'), 0);desc2.putDouble(cTID('Brgh'), 0);desc1.putObject(cTID('T '), cTID('HSBC'), desc2);desc1.putString(cTID('Srce'), "photoshopPicker");executeAction(cTID('setd'), desc1, dialogMode);};// Stopfunction step10(enabled, withDialog) {if (enabled != undefined && !enabled)return;var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);var desc1 = new ActionDescriptor();desc1.putString(cTID('Msge'),);desc1.putBoolean(cTID('Cntn'), true);executeAction(cTID('Stop'), desc1, dialogMode);};// Stopfunction step11(enabled, withDialog) {if (enabled != undefined && !enabled)return;var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);var desc1 = new ActionDescriptor();desc1.putString(cTID('Msge'),);desc1.putBoolean(cTID('Cntn'), true);executeAction(cTID('Stop'), desc1, dialogMode);};step1();// Makestep2();// Setstep3();// Setstep4();// Makestep5();// Setstep6();// Makestep7();// Selectstep8();// Setstep9();// Setstep10(true, true);// Stopstep11(true, true);// Stop},};

3.代码转执行

使用记事本或者notepad++等文本编辑器,将代码拷贝至文本文件,然后修改后缀名为js或者jsx,最后再PS软件菜单文件》脚本》浏览,点执行即可,也可以将脚本放在预设文件夹内,会显示再脚本下的二级子菜单。如下图所示:

4.作者答疑

如有疑问,请留言。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。