Scripting a layer style for each layer to make a depth pass from focus stacking information.

I'm trying to generate a depth pass from rack focus. Basically where I've gotten to right now is importing the rack focus footage each frame from as an individual layer. Then running Auto Blend Layers and letting photoshop do it's magic to mask out each layer's out of focus information. This basically gives me a bunch of layers that tell me exactly where the camera's focus was at each frame in the shot. What I need to do now is Add a color overlay (maybe in the form of a layer style) that starts at 100% black and goes to 100% white stepping through each layer.
Right now I have this, which is so very far away.
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 colorStep = 255/layerCount; //figure out how big the step of grey is between each layer.
        for (i = 1; i <= layerCount; i++){
            my_layer = [docName].layer(i);
            my_layer.applyStyle (solidFill) //add the color overly layer style
            //color the overlay using the colorStep information and layer number
What I want is an end result that looks like this.

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){}

Similar Messages

  • How do i create an animation with one frame for each layer?

    I have 76 sequential images that i've loaded as layers using bridge, then aligned using photoshop.
    I would now like to create a 76 frame animation with one animation frame for each layer
    (the layers are in sequential order).
    is there an easy way to do this
    or do i have to create 76 frames (can duplicate multiple to speed it up)
    then set layer visibility for each frame?
    thanks
    bill w
    astro.whwiii.net

    thanks for all the replies
    got it
    here's a rough draft of 2 hours of sunshine
    http://whwastro.homestead.com/files/big/31-05-2014-prom-animation.gif
    -bill w
    astro.whwiii.net

  • Select different style for each border of a rectangle

    Hi,
    I just wanted to have a Rectangle (or some other component) which one must have different style for each of its borders.
    For example I want the top and the right border with a thickness of 2 and others with a thickness of 0 (so we can only see those two borders).
    How can I do it ?
    I tried with stroke (but stroke is for all borders, we can't specify which style for which border).
    Thanks,
    Jeff

    Well it is not clear what he is looking for just rect or a component with specific border. I havnt used flex 4 so i am not sure how to get it working for that
    , but i am sure it will work on the same lines.
    I have also given another option to create a it using lineTo() and moveTo().But this should only be used if this rect is not going to be used as a container.
    I think i should elaborate...
    Create a custom component using UIComponent. In updateDisplayList() after super.updateDisplayList() call a method say drawRect(). In this drawRect() use lineTo() and moveTo() to draw the rectangle. you would have to use the component's height and width to draw the rect.
    Let me know if you need more clearification...

  • Is there a way to create separate PDFs for each layer in Indesign?

    I have a multi-layered InDesign file, and I would like to generate a PDF for each of the layers. I was able to create a LAYERED PDF file (one PDF page with layers), which is great, but I also need a multi-page PDF...one PDF page per layer.
    Is there a way to do this? Do I need a script? Or is there a way to extract the separate layers from the layered PDF?
    Any help would be much appreciated. Thank you.

    Check this script:
    http://indesignsecrets.com/page-exporter-utility-peu-5-script-updated-for-cs3.php
    Hope that helps.
    Marijan (tomaxxi)
    http://tomaxxi.com

  • Comments for each layer

    I'd like each layer to have a property sheet where I can enter comments.
    Presently, for large documents (context: cartography), I tend to write very long layer names to help keep track of colour, content, masks, styles and whatnot. So the names are always a balance of unwieldy and obtuse. It would be great if I could add proper comments, and especially if they could appear as tooltips when I hovered over the layer.
    Ideally, the same for styles and for channels.
    And for these comments to be assembled automatically, with layer names, in the XMP structure for the document. That way I could search for where I had noted a particular effect, style, or whatever, among lots of documents, without opening any of them.

    Hello,
    Can you explain it a little bit more, i don't know this option and i am also interessed in.
    Regards,
    Lionel

  • If I have two email accounts, one personal hotmail account and one MS Exchange work account, how can I setup individual notifications for each account. Right now, any email from any account has the same notification. I want work to be different than perso

    If I have two email accounts, one personal hotmail account and one MS Exchange work account on my iPhone 4s, How can I setup individual notifications for each account? Fore example, if I get a work email, I want to hear a DING, DING....If I get a personal email, I want to hear a BEEP, BEEP. Right now, any email from any account has the same notification. I want work incoming email notification to be different than personal incoming notification. The only semi-workaround I've seen is just disable any notification for the Hotmail account, so only work emails would notify. But then I don't know when I get a personal email. Even the lowely Blackberry Torch 9800 has this feature..not iPhone 4s??
    Thanks

    Sorry you get only one notification sound for all email accounts.  you can send a suggestion to apple here http://www.apple.com/feedback/

  • Independent layer sets for each artboard

    Currently the layer structure is the same over all artboards in a document. I would like to  start a new artboard with layers independent of the existing ones. A layer set will depend on the kind of artwork you create on a particular artboard, and is meaningless when you start a new artboard. So I would suggest to start each artboard with its single default layer, and add new layers only for the artboard I'm currently working on.
    Extra credit for the option to copy a layer structure from one artboard to another, though I'm not sure I'd use that much.

    Great idea/suggestion. It seems so logical and straightforward I am bewildered that this feature is not yet included in Illustrator.

  • Can you apply different paragraph styles for each orientation?

    I would like to apply different paragraph styles to the text, depending if it is viewed on portrait or landscape mode, but everytime I change one the other changes automatically. Is there a way to break this link?
    Thanks

    Unfortunately, iBA doesn't provide a lever to pull that can make a particular text style orientation specific.

  • Family sharing - kids get prompt for their iTunes account password for each purchase they make

    so I have Family Sharing setup for my wife and kids.
    My kids all have their own iCloud setup and the App/iTunes store is also logged in as themselves. (They don't have any CC info entered.)
    My problem here is that when my 5 year old wants to download/purchase anything she gets a prompt for her AppleID password.. why is that when I'm the one who has to approve all purchases/download before anyways? This system doesn't seem to be "that" kid friendly when they have to enter a complex password every time they want to download/purchase anything.
    Am I missing something? Is there a setting somewhere to disable or save password prompts for the App/iTunes store?

    Have a look here...
    http://macmost.com/setting-up-multiple-ios-devices-for-messages-and-facetime.htm l

  • Layer style screen pops up for each photo in Automate Batch processing

    Please HELP! I managed to re-record an existing Action without problem. I double click on <Set Layer style on current layer> and change to a new Layer Style for my Watermark Text. The <Contour> is Linear. The Actions panel turns red during editing.
    But when I run > Automate > Batch and select that edited Action, the <Layer Style> screen pops-up for each photo and the only way to finish the batch of photos is to click <OK> for each photo. I’m using Photoshop CS5. I have refresh Photoshop, restart my laptop but the problem remains.
    I did another copy of the original Action and just changed the
    value in <Text Layer> and it works in the Batch processing. This problem only happens when I changed the value in the <Layer Style>.
    I have been looking into many forums and still could not find the solution. I appreciate some advice as soon as possible as this problem has dragged on for two weeks now.
    Thank you in advance.

    As silly as it sounds to be, I found a way out!
    I decided to change the value again in the <Layer Style> on the same Action (ie Main WM Name 70 copy), and RUN <Automate> and on second RUN the <Layer Style> screen doesn't pop-up!
    I just couldn't believe my eyes and did some rounds of testing! And it works:
    a)Firstly, I will change the <Layer Style> to any value and saved it
    (Just to test it, I Run <Automate> and the <Layer Style> screen pops-up at each photo)
    b)Then I change again the <Layer Style> to the actual value I want
    c)Run <Automate> without the <Layer Style> screen pops-up
    To test further, oddly enough, if I change the <Layer Style> value the 3rd time, the pops-up screen appear again! And to overcome the same problem, I have to change the value 4th time, and the problem disappears.
    So simple solution (at least for me) and yet I cracked my head for two weeks to overcome it!
    Thanks for your time, c.pfaffenbichier.

  • Is there a way (script option, exporter option) to export a .psd/.psb file with nested layersets to another layered .psd file with a flat layer structure for greater compatibility? (i.e. CS6/CC/CC '14 to CS4 or older?)

    Just looking for a solution short of having to go in and manually delve through hundreds of layers and reorganize the .psd.  There's a lot of vector elements, layer effects and blending modes as well.  It'd be nice to see Adobe include an exporter for older Photoshop versions that can take a newer file and regenerate it making whatever necessary changes to maintain compatibility across older Photoshop versions and even for cross-compatibility.  I know that's not necessarily in their best interests for additional sales, but it is in the end-user's best interests when they collaborate with others across various file and application formats.

    The first problem here is Layer Styles, if I understand what you are trying to do correctly. You can have arbitrarily nested Layer Sets/Groups (each with its own Layer Style) that contain Layers with their own Layer Styles. This means that for a nested layer, you would have to take it's Layer Style and merge it with the containing Group(s) layer styles in the correct order. Then you have to do the same thing with Layer/Vector Masks and whatever else is involved. It's a non-trivial piece of work. It's not intractable, however.
    There is also the problem that some parts of the Layer Styles are binary blobs that make merging at the JS level impossible.
    If someone has implemented this, I would love to see the implementation.
    What you actually need may be a lot less complicated than the general case. If so, you may be able to find someone to help you out.
    I wish you luck.

  • Is the number of histogram pixels the same for each channel within each layer?

    Dear Photoshop Scripting Forum:
    I have written a script to isolate the number histogram pixels for each channel within each layer of a file.
    However, I have found some unexpected results: That, the number of pixels is the same for each channel within each layer.
    For example,
      Layer 1 has 18,979 pixels by itself, and so does each channel within it (Red, Green, and Blue)
      Layer 1, Channel Red, has 18,979 pixels
      Layer 1, Channel Green, has 18,979 pixels
      Layer 1, Channel Blue, has 18,979 pixels.
    This does not seem right to me.
    Does someone else have the same experience, or knowledge of something else?
    I am wondering if there is a bug in my script.
    If need be, I will post the script, but it's kind of long for a forum.
    Thank you.

    The following is for RGB 8bit images.
    The red historgram is an array of red values of the pixels that range from 0 to 255. Each element in the array has the number of pixels that have that red value. So for example if you had a layer that is pure red 255,0,0 all the pixels would be in the 255 element and there would be no pixels in the other elements. The red historgam still has the same number of pixels as the layer. They are just all in one histogram element( they all have the same value ).
    But even if you know that all the pixels in a layer are all in the last element(255) of the red histogram you still don't know the color of the pixels. A white pixel has a red value of 255. So does a yellow, magenta, etc pixel. If you only know the red value of a pixel the pixel could be one of over 65000 colors. Most of which would not be considerd 'red'
    It is the three channels together that detemine a pixel's color. Unless the layer is one color you can not tell the color of the pixels from looking at the histogram.
    Unless you use the color range selection then get the histogram of the selection. Even then you need to decide what color value make up 'red'

  • Layer Styles Not Saving for Use on Other Computers

    I've been trying over and over for the last 6 hours to get the layer styles I save in my custom pallet to work on other computers. I mean, I have a bunch of pallets from other sources and somehow they achieved a way of being able to save theirs, now why can't I do it on mine?
    So, here's the story of what I've done. I have a Text layer, I've added a list of FX to it via the Layer Styles menu. Now I save the document. I open up a new document and copy/paste the FX onto a new Text layer in another document window. It works great.
    Then, I save the layer styles for use later, but no. When I do everything exactly the same way, my Layer Style that I saved has lost all it coordinates of shadows and stroke widths, bevels, you name it, it's screwed up. Now I've tried this so far on CS4 and CS5, 3 different computers. All 3 computers have different settings for how Photoshop is set up, so I know it's NOT my settings alone. Though, it keeps the colors and custom gradients how they are, everything is bonkers.
    I'm ready to stop trusting in Photoshop to be there for me when I need it...or punch a hole in the wall. Whichever comes first.
    I need help for this as soon as possible, for I have an assignment I need this for.
    Running: Windows 7 64
    Adobe Photoshop CS4 & CS5.

    SplendidAngst wrote:
    <snip>
    Then, I save the layer styles for use later, but no. When I do everything exactly the same way, my Layer Style that I saved has lost all it coordinates of shadows and stroke widths, bevels, you name it, it's screwed up.<snip>
    Adobe Photoshop CS4 & CS5.
    Seems to me you left out the most critical piece of information, that is, HOW did you save the layer style for later use ?
    You might read this tutorial to see if you did it correctly.
    Paulo

  • Photoshop CS3 Layer Style Issue

    I have Photoshop CS3. Ever since I installed it I have had an issue with Layer Styles, one that I have not had before with other versions of Photoshop. Whenever I apply a Layer Style to a layer the Effects menu automatically drops down in the layers palette. I have to go and manually close the menus each time for every layer that I apply the style to. I have never had this problem before with any other versions of Photoshop.
    If you have any ideas or advice on how to fix this problem it would be of a great help.

    Go to the layers palette options and uncheck Expand New Effects.

  • Filter Effect and Layer Style in the same layer vs separate layers

    I'm adjusting a photographic image and am using both a filter effect and a layer style in the same layer on a Smart Object.  I want to separate the two effects into two layers, so one layer has the filter effect (Nik) and one layer has the layer style (Color Overlay) (with the goal of merging/rasterizing the Nik filter effect with the Smart Object but keeping the layer style unmerged).  I can make two layers and move one effect without problem, but the visual result of each effect on a separate layer is quite different from having both effects in the same layer.   The Blend Mode for all my layers is Normal.  Within the Color Overlay panel, the blend mode is Linear Burn.
    I don't understand why the visual result is different.  I'm not an advanced user of Photoshop, so maybe I'm missing something.  This is a trial of CS6 that I'm using.
    Layer 1: a layer style and a filter effect, stacked
    looks very different from....
    Layer 2:  a layer style
    Layer 1:  a filter effect

    If you want two separate layers, then on the duplicate layer with the Color Overlay layer style you might try different layer blending modes.
    For example, below looks the same having the Color Overlay with linear burn on the second layer and changing the layers blend mode to Hue.
    You could also put the layer in a group and apply the layer style to the group.
    (i deleted the previous post because of pilot error)
    Message was edited by: R_Kelly

Maybe you are looking for

  • AP Invoices/Credit Memo Workflow process using Optura

    Hi, We have a VIM tool Optura that we have implemented for our Workflow approval process where in the invoices/credit memos get parked, then go through a workflow approval process and finally get posted. These invoices/credit memos at the time when t

  • Applet network communication

    We currently have an applet for a online submission system for an inhouse form. The applet talks to the server hosting the applet and accesses files from the client computer, so it has a self signed cert. Apperently in a tech company accepting the ci

  • Why do microsoft users have difficulty in opening my PDF files

    Why do some microsoft users have difficulty in opening my PDF files

  • Document windows in taskbar

    Version 8 allowed you to open multiple documents but only show one instance of Acrobat on the taskbar, rather than showing each document as a separate instance (though it wasn't enabled by default, you had to choose the option). Did they remove this

  • Macbook pro OS X 10.5 can not switch on

    I have made just now a password for my macbook pro OS X 10.5 , 2009. Before I had not. Then restarted and put my password. Mac shows me that it is a wrong password. What to do?