How to flatten a single layer in photosop by using a script (js reference)?

I see a lot of script using activeDocument.flatten () but I need to know hot to flatten a single layer

activeDocument.layers [3] for example.

Thanks in advance

I'm usign cc2014 ps by the way

Hi Matias,

you're right - the layer names are not unique. Here is a version using the ID of the layer:

function rasterizeLayerByID (id) {
  var s = function(str) { return app.stringIDToTypeID(str) }
  var d = new ActionDescriptor();
  var r = new ActionReference();
  r.putIdentifier(s('layer'), id);
  d.putReference(s('target'), r);
  executeAction(s('rasterizeLayer'), d, DialogModes.NO);
}

(Both id and name) should work with smart and other objects.

Best,

Davide

Tags: Photoshop

Similar Questions

  • How to select an image (all black) describe the use of script

    Hi all

    We have thousands of clip art images to convert wmf to png. We need to apply a treatment to each image. We do this by selecting the black outline with contiguous offshore so it selects all the black. We then inverse the selection and apply the treatment to the remaining parts of the color of the image, leaving intact black. We can easily automate all steps except the first selection of black outline.

    Anyone have an idea how we can do this?

    If not do that in illustrator when we convert wmf to png and create layers it?

    Thank you.

    Here is an example of a mask created in a way that can be scripted without user intervention.

    The good news is it was easy to create a script that starts with a record of wmf files in subfolders and end with the converted png file is either in the same folder as the non-neurologique used to make the png or to a new folder while keeping the original folder structure.

    Now, it's just a matter of defining what measures to use to smooth an image. If you are happy with the mask of the sample, I can post a script for you to try on a subset of the files.

  • How to detect programmatically something dirty in labview vi using labview scripts

    Hi people,

    I'm trying to write a code that passes by a few screws and check if they have a dirty point using labview scripting but have a moment difficult trying to find a way to do this. is it possible that I can do this? any help is greatly appreciated!

    S

    Have you tried this VI property?

    http://zone.NI.com/reference/en-XX/help/371361K-01/lvprop/vi_modvi_modificat_bitset/

  • How do I open Mozila firefox with another user using any script or Bat file

    Hello...! There I want to create a bat by which I can open Firefox with a different username.

    I typed below the code and it works well in command prompt, but his does not work as a bat file.

    runas/user: domain\username "C:\Program Files\Mozila Firefox\Firefox.exe".

    or

    runas / user: ABC\XYZ "C:\Program Files\Mozila Firefox\Firefox.exe".

    Can someone help me out here. Can someone give me a code by which I can open firefox with a different user name by using the bat file.

    Hello

    Your question of Windows is more complex than what is generally answered in the Microsoft Answers forums. It is better suited for the IT Pro TechNet public. Please ask your question in the Forums Pro TechNet Windows XP IT.

  • What I lose when the flattening of a single layer?

    Can someone tell me what I lose in fact when I flatten a single layer.

    I have a large (3.4 G .tiff format) image on a single layer.

    I need to print it, but the printing software allows (2G .tiff).

    When I flattened the image, I get a background layer and the size of the image down to (370 MB).

    Now I wonder, have I just lost the picture quality. If so, it is not visible on the screen.

    I won't print to see the effect, if I can help it. Large print would be very expensive.

    Any suggestions are appreciated.

    If all your information were on a single layer, you don't lose any info. If you had a transparency on this single layer, then Yes, you lost the ability to edit using this transparency, but you don't lose any quality.

  • Center a single layer!

    Need help! Does anyone know how to Center a single layer on a web page to any resolution of the screen?

    Thank you

    Nikki

    {#Layer}
    position: absolute;
    left: 50%;
    Width: 400 PX;
    margin left:-200px;
    }

    You should try to avoid the layers, but only one can be centered in
    modern browsers using the left value of 50%, then left negative
    value of margin based on half of the assigned width - adjusted if necessary
    for the box model.

    --
    Al Sparber - PVII
    http://www.Projectseven.com
    Dreamweaver extension - Nav Systems | Galleries | Widgets
    Authors: "42nd Street: Mastering the Art of CSS Design.

    "Nikki00" wrote in message
    News:eq5a54$7l2$1@forums. Macromedia.com...
    > Need help! Does anyone know how to Center a single layer on a web site
    > page to any resolution of the screen?
    >
    > Thank you
    >
    > Nikki

  • How can I make an adjustment layer affects a single layer?

    How can I make an adjustment layer affects a single layer?

    Right-click the top layer (the adjustment layer) > create a clipping mask

    (or use the Panel menu or the menu layer or various keyboard shortcuts)

  • Use Photoshop elements 2 and I can't seem to get, but a single layer, is displayed in the palette no matter how many photos that I place in the document.  What I am doing wrong?

    Use Photoshop Elements 2 and can't seem to get, but a single layer, is displayed in the palette no matter how many picutres I place in the document.  What I am doing wrong?

    Did some reading and found my problem. Sorry if I caused any problems.  Am just true layers again. Thank you all

  • How to convert the pulse signal line single layer

    Hello

    I tried to create a VI that will allow me to convert a pulse signal (generated by a tachometer) in a line single layer, indicating that a revolution succeeded. I would like to overlay this line on other signals generated.

    I am able to detect the falling edge of the signal, but I could not make a suitable line. I tried to create a new waveform, and juggle the markers, but no method worked for me.

    Does anyone have ideas for a good way to do this?

    Below is my test VI.

    Make the second vertical lines style trace (trace style: no points, no interpolation, fill - inf). a NaN whener you don't want a power cable and a '+ inf' when you want a vertical line.

    Here's a simple example:

  • Apply the feather to a single layer

    Hello

    I am created an announcement of both parties.  One of the two parties (on two different layers) has a background image I want only the center appears and the rest I would bleach (about 90% opacity, leaving 10% of the visible background image) using feathering, as described in the pen in Photoshop with quick mask Selections

    So, does anyone know how to apply these feathers on a single layer?

    Thank you!

    -Ron

    Create a layer mask and apply the pen in the properties panel.

    Could you please post a screenshot with the Panel visible layers?

  • Script: A single layer to set the opacity of the other layers?

    Hello

    I have a lot of layers in my computer whose name begins with "POINTER_".

    I need these layers to falter at the same time.

    But I can't the subcomp or use stencil alpha.

    I don't know that it is possible to make a script on an adjustment layer that would do just that.

    All he needs to do is to allow me to make keyframes this adjustment layer opacity associated then with the opacity of each layer starting by 'POINTER_ '.

    I'm not a guy of script, so it would be great if someone could show me how to do this.

    Thank you very much!

    see you soon,

    Chris

    You don't need a script to do this; you need an expression.

    You can easily bind properties between layers with expressions. In this case, you apply an effect cursor Expression to your layer zero (or just use the property opacity of an adjustment layer). ALT-click on the opacity for one of your layers property then use the pick whip to choose cursor effect or the property opacity of your layer of control. Now, when you change the value of a single layer, the others follow. You can copy and paste the expression resulting from your icon from selection for the other layers. (You can even choose to copy expression only and then paste that to the rest of the layers).

  • Is there a button that removes all colors fill in a single layer?

    I was wondering if there was a quick way to remove all fill colors in a single layer, which leaves only the contour lines. This is for Illustrator CS5. Thank you

    sinsenest,

    How about clicking on the layer in the layers palette to select the entire document in it, then activate/selection of the fill box in the Toolbox and clicking None?

  • How to adjust the text layer

    Hello

    I have a pretty simple question on layer adjustments. I have a block of text and a picture, but what I want is for the text remains in front of the image and not behind it. How to set the text frame layer that is at the forefront and not hidden by graphics?

    Thank you.

    Rylenol

    You have in fact two layers, or are the two objects on the same layer? If you have two layers, open the Panel layers, and then drag the layer with the text is above the layer with the image.

    If you now have a single layer, create a second layer in the layers panel, and then select the text. You will see a little point to the right of the name of the layer that represents what is selected - which dot drag the new layer and it will move the selction to the new layer.

    Or you can change the order of stacking in a single layer. When you add new items each new object becomes the top of the stack. You can change this setting by selecting any item and in the menu object, choose layout > and one of the optins to move the object upward or down one position at a time or all the way at the top or bottom of the stack.

    Peter

  • How to solve the single FAX problems

    After HP8600 is installed, what impression the network always goes to FAX instead of the printer. How to solve the single FAX problems

    Hello jim3258and welcome to the Forums of HP, I hope you enjoy your experience!

    I see that you have problems printing and fax.  I'd love to try to help you, but I need some information first. I'm a link some HP Support documents below that will show you how to find the number for your product. In addition, please indicate what operating system you are using. In addition, if you are using Windows, please indicate if your operating system is 32-bit or 64-bit. With this information and the product number we provide you with accurate information.

    How can I find my model number or product number?
    Mac OS X: how to find which Mac OS X Version is on my computer?
    Operating system Windows am I running?
    Is the Version of Windows on my computer 32-bit or 64-bit?

    Please let me know what you find.  Thanks for posting on the HP Forums!

  • How to convert a single byte String?

    Purpose:

    Show a result byte on the BB 9900 screen.

    Question:

    How to convert a single byte String?

    Part of the code:

    byte value = con.cpu_config.elementAt (i)

    stop here

    String valuestring = new String (value);

    _rtf. SetText (valueString);

    If you know how to fix it, please share your idea.

    Thank you for your attention,

    String valuestring = new String (new byte [] {value}};)

    _data. Append (valueString);

    _rtf. SetText (_data.toSrting ());

    Solve it.

Maybe you are looking for