This content has been marked as final.
Show 1 reply
-
1. Re: Scripting a layer style for each layer to make a depth pass from focus stacking information.
Michael L Hale Sep 23, 2013 12:27 PM (in response to michaelmcreynolds)The only focus stacking I have done is with macro photography. Below is a script that adds the layer effects but the results with my macro samples did not turn out looking good. Maybe you will have better luck with the type of photography you are doing.
function ftn1(r,g,b) { var desc = new ActionDescriptor(); var ref = new ActionReference(); ref.putProperty( charIDToTypeID('Prpr'), charIDToTypeID('Lefx') ); ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') ); desc.putReference( charIDToTypeID('null'), ref ); var effectsDesc = new ActionDescriptor(); //effectsDesc.putUnitDouble( charIDToTypeID('Scl '), charIDToTypeID('#Prc'), 333.333333 ); var colorfillDesc = new ActionDescriptor(); colorfillDesc.putBoolean( charIDToTypeID('enab'), true ); colorfillDesc.putEnumerated( charIDToTypeID('Md '), charIDToTypeID('BlnM'), charIDToTypeID('Nrml') ); colorfillDesc.putUnitDouble( charIDToTypeID('Opct'), charIDToTypeID('#Prc'), 100.000000 ); var rgbcDesc = new ActionDescriptor(); rgbcDesc.putDouble( charIDToTypeID('Rd '), r ); rgbcDesc.putDouble( charIDToTypeID('Grn '), g ); rgbcDesc.putDouble( charIDToTypeID('Bl '), b ); colorfillDesc.putObject( charIDToTypeID('Clr '), charIDToTypeID('RGBC'), rgbcDesc ); effectsDesc.putObject( charIDToTypeID('SoFi'), charIDToTypeID('SoFi'), colorfillDesc ); desc.putObject( charIDToTypeID('T '), charIDToTypeID('Lefx'), effectsDesc ); executeAction( charIDToTypeID('setd'), desc, DialogModes.NO ); }; try { // var docName = app.activeDocument.name; // save the app.activeDocument name before duplicate. // var layerCount = app.documents[docName].layers.length; //figure out how many layers var docRef = app.activeDocument; var layerCount = docRef.artLayers.length; var colorStep = 255/layerCount; //figure out how big the step of grey is between each layer. var color = 255; for (i = 0; i <= layerCount; i++){ docRef.activeLayer = docRef.artLayers[i]; ftn1( color, color, color); color=color-colorStep; } }catch(e){}


