Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
activeDocument.quickMaskMode=false;
if(!activeDocument.activeLayer.isBackgroundLayer)
activeDocument.activeLayer.blendMode = BlendMode.NORMAL;
var sourceLayer=activeDocument.activeLayer;
var rLayer=activeDocument.activeLayer.duplicate();
activeDocument.activeLayer=rLayer;
var idChnM = charIDToTypeID( "ChnM" );
var desc3 = new ActionDescriptor();
var idpresetKind = stringIDToTypeID( "presetKind" );
var idpresetKindType = stringIDToTypeID( "presetKindType" );
var idpresetKindCustom = stringIDToTypeID( "presetKindCustom" );
desc3.putEnumerated( idpresetKind, idpresetKindType, idpresetKindCustom );
var idMnch = charIDToTypeID( "Mnch" );
desc3.putBoolean( idMnch, true );
var idGry = charIDToTypeID( "Gry " );
var desc4 = new ActionDescriptor();
var idRd = charIDToTypeID( "Rd " );
var idPrc = charIDToTypeID( "#Prc" );
desc4.putUnitDouble( idRd, idPrc, 100.000000 );
var idChMx = charIDToTypeID( "ChMx" );
desc3.putObject( idGry, idChMx, desc4 );
executeAction( idChnM, desc3, DialogModes.NO );
activeDocument.activeLayer=sourceLayer;
var gLayer=activeDocument.activeLayer.duplicate();
activeDocument.activeLayer=gLayer;
var idChnM = charIDToTypeID( "ChnM" );
var desc29 = new ActionDescriptor();
var idpresetKind = stringIDToTypeID( "presetKind" );
var idpresetKindType = stringIDToTypeID( "presetKindType" );
var idpresetKindCustom = stringIDToTypeID( "presetKindCustom" );
desc29.putEnumerated( idpresetKind, idpresetKindType, idpresetKindCustom );
var idMnch = charIDToTypeID( "Mnch" );
desc29.putBoolean( idMnch, true );
var idGry = charIDToTypeID( "Gry " );
var desc30 = new ActionDescriptor();
var idGrn = charIDToTypeID( "Grn " );
var idPrc = charIDToTypeID( "#Prc" );
desc30.putUnitDouble( idGrn, idPrc, 100.000000 );
var idChMx = charIDToTypeID( "ChMx" );
desc29.putObject( idGry, idChMx, desc30 );
executeAction( idChnM, desc29, DialogModes.NO );
activeDocument.activeLayer=sourceLayer;
var bLayer=activeDocument.activeLayer.duplicate();
activeDocument.activeLayer=bLayer;
var idChnM = charIDToTypeID( "ChnM" );
var desc33 = new ActionDescriptor();
var idpresetKind = stringIDToTypeID( "presetKind" );
var idpresetKindType = stringIDToTypeID( "presetKindType" );
var idpresetKindCustom = stringIDToTypeID( "presetKindCustom" );
desc33.putEnumerated( idpresetKind, idpresetKindType, idpresetKindCustom );
var idMnch = charIDToTypeID( "Mnch" );
desc33.putBoolean( idMnch, true );
var idGry = charIDToTypeID( "Gry " );
var desc34 = new ActionDescriptor();
var idBl = charIDToTypeID( "Bl " );
var idPrc = charIDToTypeID( "#Prc" );
desc34.putUnitDouble( idBl, idPrc, 100.000000 );
var idChMx = charIDToTypeID( "ChMx" );
desc33.putObject( idGry, idChMx, desc34 );
executeAction( idChnM, desc33, DialogModes.NO );
rLayer.blendMode = BlendMode.DARKEN;
gLayer.blendMode = BlendMode.DARKEN;
activeDocument.activeLayer=rLayer;
activeDocument.activeLayer=activeDocument.activeLayer.merge();
maskLayer=activeDocument.activeLayer.merge();
activeDocument.activeLayer=maskLayer;
activeDocument.selection.selectAll();
activeDocument.selection.copy();
maskLayer.remove();
activeDocument.activeLayer=sourceLayer;
var resultLayer=activeDocument.activeLayer.duplicate();
activeDocument.activeLayer=resultLayer;
activeDocument.quickMaskMode=true;
activeDocument.selection.selectAll();
activeDocument.paste(true);
activeDocument.quickMaskMode=false;
activeDocument.selection.clear();
activeDocument.selection.deselect();
// =======================================================
var idRmvW = charIDToTypeID( "RmvW" );
executeAction( idRmvW, undefined, DialogModes.NO );
activeDocument.activeLayer=sourceLayer;
var whiteLayer=activeDocument.activeLayer.duplicate();
activeDocument.activeLayer=whiteLayer;
activeDocument.selection.selectAll();
RGBColor = new SolidColor();
RGBColor.red = 255;
RGBColor.green = 255;
RGBColor.blue = 255;
activeDocument.selection.fill(RGBColor,ColorBlendMode.NORMAL, 100, false);
activeDocument.selection.deselect();
activeDocument.activeLayer=resultLayer;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment