Photoshop插件-完美肌肤-脚本开发-PS插件

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

1.插件界面

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


92f48b2840e94d569aeda9b42400ccb9.png

2.关键代码-完美肌肤

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

cTID = function (s) {
    return app.charIDToTypeID(s);
};
sTID = function (s) {
    return app.stringIDToTypeID(s);
};

//
//==================== Perfect Skin Pro ==============
//
$._ext_001 = {
    run: function PerfectSkinPro() {
        // Make
        function 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(cTID('Lyr '));
            desc1.putReference(cTID('null'), ref1);
            executeAction(cTID('Mk  '), desc1, dialogMode);
        };

        // Merge Visible
        function step2(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            desc1.putBoolean(cTID('Dplc'), true);
            executeAction(sTID('mergeVisible'), desc1, dialogMode);
        };

        // Set
        function 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();
            desc2.putString(cTID('Nm  '), "Blur");
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Make
        function 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(cTID('Lyr '));
            desc1.putReference(cTID('null'), ref1);
            executeAction(cTID('Mk  '), desc1, dialogMode);
        };

        // Merge Visible
        function step5(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            desc1.putBoolean(cTID('Dplc'), true);
            executeAction(sTID('mergeVisible'), desc1, dialogMode);
        };

        // Set
        function step6(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  '), "Blur II");
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Make
        function 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('Lyr '));
            desc1.putReference(cTID('null'), ref1);
            executeAction(cTID('Mk  '), desc1, dialogMode);
        };

        // Merge Visible
        function step8(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            desc1.putBoolean(cTID('Dplc'), true);
            executeAction(sTID('mergeVisible'), desc1, dialogMode);
        };

        // Set
        function step9(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  '), "Details 10px");
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Make
        function step10(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('Lyr '));
            desc1.putReference(cTID('null'), ref1);
            executeAction(cTID('Mk  '), desc1, dialogMode);
        };

        // Merge Visible
        function step11(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            desc1.putBoolean(cTID('Dplc'), true);
            executeAction(sTID('mergeVisible'), desc1, dialogMode);
        };

        // Set
        function step12(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  '), "Details 1px");
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Select
        function step13(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            var ref1 = new ActionReference();
            ref1.putName(cTID('Lyr '), "Blur");
            desc1.putReference(cTID('null'), ref1);
            desc1.putBoolean(cTID('MkVs'), false);
            executeAction(cTID('slct'), desc1, dialogMode);
        };

        // Convert to Smart Object
        function step14(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            executeAction(sTID('newPlacedLayer'), undefined, dialogMode);
        };

        // Gaussian Blur
        function step15(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            desc1.putUnitDouble(cTID('Rds '), cTID('#Pxl'), 8);
            executeAction(sTID('gaussianBlur'), desc1, dialogMode);
        };

        // Surface Blur
        function step16(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            desc1.putUnitDouble(cTID('Rds '), cTID('#Pxl'), 35);
            desc1.putInteger(cTID('Thsh'), 35);
            executeAction(sTID('surfaceBlur'), desc1, dialogMode);
        };

        // Set
        function step17(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.putEnumerated(cTID('Md  '), cTID('BlnM'), cTID('Lghn'));
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Select
        function step18(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            var ref1 = new ActionReference();
            ref1.putName(cTID('Lyr '), "Blur II");
            desc1.putReference(cTID('null'), ref1);
            desc1.putBoolean(cTID('MkVs'), false);
            executeAction(cTID('slct'), desc1, dialogMode);
        };

        // Convert to Smart Object
        function step19(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            executeAction(sTID('newPlacedLayer'), undefined, dialogMode);
        };

        // Gaussian Blur
        function step20(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            desc1.putUnitDouble(cTID('Rds '), cTID('#Pxl'), 8);
            executeAction(sTID('gaussianBlur'), desc1, dialogMode);
        };

        // Surface Blur
        function step21(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            desc1.putUnitDouble(cTID('Rds '), cTID('#Pxl'), 35);
            desc1.putInteger(cTID('Thsh'), 35);
            executeAction(sTID('surfaceBlur'), desc1, dialogMode);
        };

        // Select
        function step22(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            var ref1 = new ActionReference();
            ref1.putName(cTID('Lyr '), "Blur");
            desc1.putReference(cTID('null'), ref1);
            desc1.putBoolean(cTID('MkVs'), false);
            executeAction(cTID('slct'), desc1, dialogMode);
        };

        // Set
        function step23(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'), 0);
            desc3.putInteger(cTID('Dstl'), 125);
            desc3.putInteger(cTID('DstW'), 125);
            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);
        };

        // Select
        function step24(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            var ref1 = new ActionReference();
            ref1.putName(cTID('Lyr '), "Blur II");
            desc1.putReference(cTID('null'), ref1);
            desc1.putBoolean(cTID('MkVs'), false);
            executeAction(cTID('slct'), desc1, dialogMode);
        };

        // Set
        function step25(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.putEnumerated(cTID('Md  '), cTID('BlnM'), cTID('Mltp'));
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Set
        function step26(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'), 0);
            desc3.putInteger(cTID('Dstl'), 125);
            desc3.putInteger(cTID('DstW'), 125);
            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);
        };

        // Set
        function step27(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.putEnumerated(cTID('Md  '), cTID('BlnM'), cTID('Drkn'));
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Set
        function step28(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.putUnitDouble(cTID('Opct'), cTID('#Prc'), 60);
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Select
        function step29(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            var ref1 = new ActionReference();
            ref1.putName(cTID('Lyr '), "Blur II");
            desc1.putReference(cTID('null'), ref1);
            desc1.putBoolean(cTID('MkVs'), false);
            executeAction(cTID('slct'), desc1, dialogMode);
        };

        // Select
        function step30(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            var ref1 = new ActionReference();
            ref1.putName(cTID('Lyr '), "Blur");
            desc1.putReference(cTID('null'), ref1);
            desc1.putEnumerated(sTID("selectionModifier"), sTID("selectionModifierType"), sTID("addToSelectionContinuous"));
            desc1.putBoolean(cTID('MkVs'), false);
            executeAction(cTID('slct'), desc1, dialogMode);
        };

        // Merge Layers
        function step31(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            executeAction(sTID('mergeLayersNew'), desc1, dialogMode);
        };

        // Set
        function step32(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  '), "Cleansed Skin");
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Select
        function step33(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            var ref1 = new ActionReference();
            ref1.putName(cTID('Lyr '), "Details 10px");
            desc1.putReference(cTID('null'), ref1);
            desc1.putBoolean(cTID('MkVs'), false);
            executeAction(cTID('slct'), desc1, dialogMode);
        };

        // Convert to Smart Object
        function step34(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            executeAction(sTID('newPlacedLayer'), undefined, dialogMode);
        };

        // High Pass
        function step35(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            desc1.putUnitDouble(cTID('Rds '), cTID('#Pxl'), 10);
            executeAction(sTID('highPass'), desc1, dialogMode);
        };

        // Set
        function step36(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.putEnumerated(cTID('Md  '), cTID('BlnM'), cTID('SftL'));
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Set
        function step37(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.putUnitDouble(cTID('Opct'), cTID('#Prc'), 50);
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Select
        function step38(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            var ref1 = new ActionReference();
            ref1.putName(cTID('Lyr '), "Details 1px");
            desc1.putReference(cTID('null'), ref1);
            desc1.putBoolean(cTID('MkVs'), false);
            executeAction(cTID('slct'), desc1, dialogMode);
        };

        // Convert to Smart Object
        function step39(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            executeAction(sTID('newPlacedLayer'), undefined, dialogMode);
        };

        // High Pass
        function step40(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            desc1.putUnitDouble(cTID('Rds '), cTID('#Pxl'), 1);
            executeAction(sTID('highPass'), desc1, dialogMode);
        };

        // Set
        function step41(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.putEnumerated(cTID('Md  '), cTID('BlnM'), sTID("vividLight"));
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Select
        function step42(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            var ref1 = new ActionReference();
            ref1.putName(cTID('Lyr '), "Cleansed Skin");
            desc1.putReference(cTID('null'), ref1);
            desc1.putEnumerated(sTID("selectionModifier"), sTID("selectionModifierType"), sTID("addToSelectionContinuous"));
            desc1.putBoolean(cTID('MkVs'), false);
            executeAction(cTID('slct'), desc1, dialogMode);
        };

        // Make
        function step43(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);
        };

        // Set
        function step44(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  '), "Perfect Skin");
            desc1.putObject(cTID('T   '), cTID('Lyr '), desc2);
            executeAction(cTID('setd'), desc1, dialogMode);
        };

        // Make
        function step45(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('RvlA'));
            executeAction(cTID('Mk  '), desc1, dialogMode);
        };

        // Set
        function step46(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);
        };

        // Set
        function step47(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);
        };

        // Fill
        function step48(enabled, withDialog) {
            if (enabled != undefined && !enabled)
                return;
            var dialogMode = (withDialog ? DialogModes.ALL : DialogModes.NO);
            var desc1 = new ActionDescriptor();
            desc1.putEnumerated(cTID('Usng'), cTID('FlCn'), cTID('BckC'));
            desc1.putUnitDouble(cTID('Opct'), cTID('#Prc'), 100);
            desc1.putEnumerated(cTID('Md  '), cTID('BlnM'), cTID('Nrml'));
            executeAction(cTID('Fl  '), desc1, dialogMode);
        };

        step1();      // Make
        step2();      // Merge Visible
        step3();      // Set
        step4();      // Make
        step5();      // Merge Visible
        step6();      // Set
        step7();      // Make
        step8();      // Merge Visible
        step9();      // Set
        step10();      // Make
        step11();      // Merge Visible
        step12();      // Set
        step13();      // Select
        step14();      // Convert to Smart Object
        step15();      // Gaussian Blur
        step16();      // Surface Blur
        step17();      // Set
        step18();      // Select
        step19();      // Convert to Smart Object
        step20();      // Gaussian Blur
        step21();      // Surface Blur
        step22();      // Select
        step23();      // Set
        step24();      // Select
        step25();      // Set
        step26();      // Set
        step27();      // Set
        step28();      // Set
        step29();      // Select
        step30();      // Select
        step31();      // Merge Layers
        step32();      // Set
        step33();      // Select
        step34();      // Convert to Smart Object
        step35();      // High Pass
        step36();      // Set
        step37();      // Set
        step38();      // Select
        step39();      // Convert to Smart Object
        step40();      // High Pass
        step41();      // Set
        step42();      // Select
        step43();      // Make
        step44();      // Set
        step45();      // Make
        step46();      // Set
        step47();      // Set
        step48();      // Fill
    },

};

3.作者答疑


  代码长度过长,如需全部项目或有疑问,请留言。

提示: 作者知了-联系方式1
提示: 作者知了-联系方式2

©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 204,530评论 6 478
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 86,403评论 2 381
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 151,120评论 0 337
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,770评论 1 277
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,758评论 5 367
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,649评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,021评论 3 398
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,675评论 0 258
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,931评论 1 299
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,659评论 2 321
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,751评论 1 330
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,410评论 4 321
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,004评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,969评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,203评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,042评论 2 350
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,493评论 2 343

推荐阅读更多精彩内容