Resize all layers

I'm looking for a way to resize all layers in my document to a specific size.  I would like to resize each layer to be exactly 6 inches in height (with limited proportions).   I can manually turn each layer to do this, but I have not found a way to do this automatically to all layers, is it possible?   I tried to do in the form of action, but it's recording as a percentage and not a fixed height, so it does not work on the other layers that are not of the same size.

Here's a script that will resize itself of SELECTED layers to 6 "in height.

#target photoshop
function main(){
if(!documents.length) return;
var selectedLayers = getSelectedLayersIdx();
for (var z in selectedLayers){
selectLayerByIndex(Number(selectedLayers[z]));
resizeLayer();
    }
}
main();
function resizeLayer(){
var startRulerUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var doc = activeDocument;
var res= doc.resolution;
var LB = activeDocument.activeLayer.bounds;
var Height = LB[3].value - LB[1].value;
var onePix = 100/Height;
var newSize = onePix * (res * 6);
doc.activeLayer.resize( newSize , newSize, AnchorPosition.MIDDLECENTER);
app.preferences.rulerUnits = startRulerUnits;
}
function selectLayerByIndex(index,add){
 add = (add == undefined)  ? add = false : add;
 var ref = new ActionReference();
    ref.putIndex(charIDToTypeID("Lyr "), index);
    var desc = new ActionDescriptor();
    desc.putReference(charIDToTypeID("null"), ref );
       if(add) desc.putEnumerated( stringIDToTypeID( "selectionModifier" ), stringIDToTypeID( "selectionModifierType" ), stringIDToTypeID( "addToSelection" ) );
      desc.putBoolean( charIDToTypeID( "MkVs" ), false );
   try{
    executeAction(charIDToTypeID("slct"), desc, DialogModes.NO );
}catch(e){}
};
function getSelectedLayersIdx(){
      var selectedLayers = new Array;
      var ref = new ActionReference();
      ref.putEnumerated( charIDToTypeID("Dcmn"), charIDToTypeID("Ordn"), charIDToTypeID("Trgt") );
      var desc = executeActionGet(ref);
      if( desc.hasKey( stringIDToTypeID( 'targetLayers' ) ) ){
         desc = desc.getList( stringIDToTypeID( 'targetLayers' ));
          var c = desc.count
          var selectedLayers = new Array();
          for(var i=0;i 
         

Tags: Photoshop

Similar Questions

  • How to resize the layers (and keep the properties)

    Hello to all and forgive my lack of knowledge of the AferEffects.  Currently, I got the task to my work to create a video for a display at a local arena.  The height of the screen of the arena is 36px.  I bought a model of Envato that I liked but resizing has been a problem.  I created a new composition for the appropriate specifications and copied the model layers in my new composition.  "Then I went to the size equal to the composition but noticed that there are layer 'points' and I guess that 'transformations or effects' ' are not scale with the height of the composition.

    Is there an easy way to resize the layers and all their properties to meet up to my composition?

    Thanks in advance and I promise you I won't go to the current on the use of AE, but for the moment I'll have to get finishing with searches google and help forum.

    Have you tried to use the script of the Composition of the ladder by going to file - Scripts - scale Composition.  Define a height 36, click scale and then copy and paste all your layers model comp above the 36 x 2760 model. Who should maintain relationships between all layer properties in the model.  Forgive me if I'm struggling to understand what you're trying to do, but a few screenshots of your comps might help illustrate your workflow.

  • All layers of LayerKind.NORMAL if the document is not active?

    I just discovered the strange behavior. If trying to find the type of layer to a layer in a document that is not currently the activeDocument, all layers are returned as LayerKind.NORMAL. However, if the document is the activeDocument, the correct kind of layer is returned.

    For example:

    Screen Shot 2016-07-24 at 16.23.16.png

    Two documents open, if I have the other document selected, this:

    documents[0].layers[1].kind
    

    Will return "result: LayerKind.NORMAL'., but if I then select the above document, it will return" result: ' LayerKind.CURVES

    What is happening with this?

    Yes, it's a weird bug. It affects other functions when open dealing with scripts with several documents. You really need to make sure that everything you do on a particular file, you must have this file in the current document. For example, you can not duplicate the layers in a file that is not the active document. I'm sure there are other examples, but this is the one I met.

  • Is it possible to rasterize all layers EXCEPT the text layers?

    Is it possible to rasterize all layers EXCEPT the text layers? Other than each non-text layer selection then by selecting layer > rasterize > layers. Maybe someone had a script for this that they could share?

    Layer to smart object, shape layers, layer and setting.

    Use the filters at the top of the layers panel, and then click to view the layer to rasterize (note that include adjustment layers)

    Click the red button to enable or disable filters.

    Select the filtered layer and right-click and choose rasterize

    Job done.

  • Why didn't - not the dialog box 'sample all layers' that displays in the Spot Healing Brush Panel?

    Why the "sample all layers" dialog box is not displayed in my Spot Healing Brush in Photoshop CC Panel - can I have disabled this option in error?  Can I fix it simply?

    Can you post a screenshot of your light?

    That's what you should see the tool options in photoshop cc 2015.1.2 with the Spot Healing Brush tool selected.

    Check in the photoshop Preferences > workspace and see if close Enable option bar is selected that has a different appearance of the symbols in the options toolbar.

  • Flatten all layers including the background (but not locked layers)

    Is there a way of

    Flatten all layers including the background excluding all locked layers Layer

    and then turn off visibility for locked layers

    Any help most welcome!

    After my previous error, I tried a solution, and you can give it a try:

    2015, use it at your own risk.

    #target photoshop

    If (app.documents.length > 0) {}

    myDocument var = app.activeDocument;

    var theLayers = getLayersIndexAndID ();

    Hide locked;

    for (var m = 0; m< thelayers.length;="" m++)="">

    If (theLayers [m] [3] == true) {hideByID (theLayers [m] [2])}

    };

    Merge visible layers;

    myDocument.activeLayer = myDocument.layers [myDocument.layers.length - 1];

    myDocument.layers [myDocument.layers.length - 1] .visible = true;

    // =======================================================

    var idMrgV = charIDToTypeID ("MrgV");

    executeAction (idMrgV, undefined, DialogModes.NO);

    };

    ////////////////////////////////////

    function getLayersIndexAndID () {}

    Var ref = new ActionReference();

    ref.putEnumerated (charIDToTypeID ("Dcmn"), charIDToTypeID ("Ordn"), charIDToTypeID ("Trgt"));

    var applicationDesc = executeActionGet (ref);

    var number = applicationDesc.getInteger (stringIDToTypeID ("numberOfLayers"));

    var theArray = new Array;

    work in layers.

    for (var m = number; m > = 0; m-) {}

    try {}

    Var ref = new ActionReference();

    ref.putIndex (charIDToTypeID ("Lyr"), m);

    var layerDesc = executeActionGet (ref);

    var layerSet is typeIDToStringID (layerDesc.getEnumerationValue (stringIDToTypeID ("layerSection")));.

    isBackground var = layerDesc.getBoolean (stringIDToTypeID ('background'));

    theName var = layerDesc.getString (stringIDToTypeID ('name'));

    theID var = layerDesc.getInteger (stringIDToTypeID ('layerID'));

    locking of the var = layerDesc.getObjectValue (stringIDToTypeID ("layerLocking"));

    anyLock var = false;

    for (var a = 0;< locking.count;="" a++)="">

    var thisLock = locking.getBoolean (locking.getKey (a));

    If (thisLock == true) {anyLock = true}

    };

    ////////////////////////////////////

    If start of Group:

    If (layerSet! = "layerSectionEnd" & isBackground! = true) {}

    theArray.push ([theName, m, anyLock theID])

    };

    ////////////////////////////////////

    }

    catch (e) {};

    };

    the results;

    return theArray

    };

    hide the layer.

    function hideByID (theID) {}

    // =======================================================

    idHd var = charIDToTypeID ('Hd');

    var desc2 = new ActionDescriptor();

    var idnull = charIDToTypeID ("null");

    var list1 = new ActionList();

    var ref1 = new ActionReference();

    Ref1.putIdentifier (charIDToTypeID ("Lyr"), theID);

    List1.putReference (ref1);

    desc2.putList (idnull, list1);

    executeAction (idHd desc2, DialogModes.NO);

    };

  • CTRL-r: can this select all layers when in the window of the model please?

    Thank you

    Cmnd/CTRL + A selects all layers in the timeline panel or the Comp panel when panels are selected. In the project Panel, he would choose all of the assets within the Panel. Have you tried it? The only way to have that does not work is to have another selected Panel.

  • Find and replace all layers

    Hi all

    How can I find and change in all layers so hidden layer

    app.findGrepPreferences.findWhat = "\\s\\s+";

    app.changeGrepPreferences.changeTo = "";

    app.changeGrep ();

    app.findGrepPreferences = app.changeGrepPreferences = null;

    Thank you

    Steve

    app.findChangeGrepOptions.includeHiddenLayers = true;
    
  • script to unlock all layers in the illustrator file

    Hello!

    I run a batch place script the name of the document in the image and then save the document, all documents in a foder.

    However, he refuses to put this text, that the target layer is blocked at the outset.

    I'm looking for, so a piece of script that I can add to this script that will be first to unlock all layers in the document.

    Can someone help me with this?

    Something like this unlocks all the layers:

    myDoc = app.activeDocument;

    myLayers = myDoc.layers;

    for (a = 0;

    myLayer = myLayers [a];

    myLayer.locked = false;

    }

    But it is not unlock all items on layers.

    HTH,

    Ariel

  • JavaScript - deselect all layers

    Is there a simple command to deselect all layers in the document view via javascript? I run a script which is getting fouled upward if there is a layer selected in the document.

    This will deselect all layers Mark...

    function deselectLayers() {
        var desc01 = new ActionDescriptor();
            var ref01 = new ActionReference();
            ref01.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
        desc01.putReference( charIDToTypeID('null'), ref01 );
        executeAction( stringIDToTypeID('selectNoLayers'), desc01, DialogModes.NO );
    };
    
  • Layer all layers below neutral collection inside a group screw

    A group in NORMAL mode with a NEUTRAL OVERLAY layer blocks all layers below and outside the Group with a solid gray color.  Feature or problem?

    No, I'm not saying that.

    You said that, within the normal group is a layer of neutral grey coating over a layer containing a tree surrounded by absolute transparency. When the group content is evaluated, gray will be mixed with absolute transparency to produce the same gray, and the result will be a tree surrounded by gray. Then it's Normal-mixed with the layer of Earth under the group, which translates as the layer of earth being obscured.

  • Is it possible to resize all work plans at the time the way that you used to be able to do in the configuration of document?

    I have a document with 20 work plans. When I resize a that only changes that are. I'm in CS5. Is it possible to resize all work plans at the time the way that you used to be able to do in the configuration of document? Thank you very much!

    Wade_Zimmerman wrote:

    It's a good script but t vrry does not resize some plans of work and not wouldn't

    @ Wade

    You can recode and a confirm in the loop to determine if you want to resize the work plan current in the iteration of the loop, if no installation then jump her, if yes then prompt for sizes and move forward. Then you can resize regardless of those that you wish as such, some and not others. You can even distinguish with each confirm and ask what work targeted plan by displaying its name. I tested this approach and it seems to work ok, but not super stylish, of course, because if you have tons of work plans, it would be a large number of guests/entry. You could lesson prompts by combining the width/height in a single guest. But then again, even at this time sound just as effective to resize each manually via the window of work plans, probably the same amount of work/time user input processing and the targeting of individual work plans. You could perhaps also create script window for multiple entry for plans of work desired, may be based on the selected and build your dialogue window accordingly, I suppose that, at this time, it would provide a more effective approach for this kind of thing that you seem to be describing.

    But that all said that we would be well beyond the original request that CarlosCanto already so generously filled. He might have some comments on your comments.

  • Unlock all layers

    Hello world.

    I received an illustrator file with thousands of layers/sublayers, one of them is locked and illustrator won't let me replace a font because, says that "layer is locked.

    There is a command to unlock all layers?

    or to force a policy of replacement without unlocking?

    Thank you

    Try locking of one of your top layers. It will be available then as in this case

    When I had no upper layers locked, it seemed like yours.

  • Show all layers CS5

    How can I display all layers visible? If I turned off sublayers, they turn on when to use display all layers.

    A very important command I use several times a day

    Object > show all

    Faculty of the cmd 3

  • Stop in the timeline - do not show all layers. How?

    I am an experienced AfterEffects, FCP and user of Camtasia, but new to Captivate. Currently using Captivate CS5.5 and cannot understand why Captivate shows ALL layers of content when the PlayBar stops rather than only the active layers at this point in time. Is there a way to defeat this behavior? It makes me absolutely CRAZY! Cannot find the answer on other resources. -Thx!

    Hello

    When you edit the slide, you'll see all the objects that are on this slide. When you drag the playhead, you will see only the objects that are active at this time, but when you let the head of reading all the objects will be there once again. Sorry, it's as well as CP is designed. This move does not create real insight, who needs a temporary creation a SWF file. This is only possible with methods of real preview (F4, F8, F12). Captivate isn't a video application, such as Camtasia or AfterEffects. It has the benefits of having all the visible objects like to align the purposes; forget the pure video where the handling of different objects is not at all easy. If you want to align the beginning of a timeline object with playhead, use CTRL-L. Perhaps you will help my blog post on the timeline, it is for the starters in Captivate:

    TinyTimelineTidbits

    Lilybiri

Maybe you are looking for