Skip to main content
kevinh61866897
Participating Frequently
October 27, 2018
Answered

Modifying multiple layers for export as JPEG Photsohop

  • October 27, 2018
  • 1 reply
  • 452 views

1. Imported video frames to layers

2. ~400 layers

3. Need to crop and change brightness of each layer.

4. Need to export layers as files (JPEG) through scripts

I know how to crop but I can only seem to change the brightness on each individual layer.

I know about creating an adjustment layer and putting it at the top layer. But when I go to export the layers as jpeg they maintain their original format.

Any idea how to batch change a series of layers or how to export the above? I cant seem to  get the copy layer style to be active ..even after I convert a layer to a smart object.

Thanks

KH

    This topic has been closed for replies.
    Correct answer Chuck Uebele

    This is a script that I wrote for someone else with the same issue. It will copy and merge an adjustment layer with all the other layers, so all the layers will have the adjustment layer applied to them and can then be exported. Make sure you make a copy of your file first! And select the adjustment layer before running the script.

    #target photoshop

    var doc = activeDocument;

    var adjL = doc.activeLayer

    for(var i = adjL.parent.layers.length-1;i>0;i--){

        doc.activeLayer = adjL.parent.layers;

        var nextL = doc.activeLayer

        if(nextL.name == adjL.name){break;}

        if(nextL.typename !='LayerSet'){

            try{

                doc.activeLayer = adjL

                dupeL ();

                var tempL = doc.activeLayer

                tempL.move(nextL,ElementPlacement.PLACEBEFORE);

                mergeL ();

                }

            catch(e){

                tempL.remove()

                }

            }

      

        }

    function mergeL(){

        var idMrgtwo = charIDToTypeID( "Mrg2" );

            var desc5 = new ActionDescriptor();

        executeAction( idMrgtwo, desc5, DialogModes.NO );

        }

    function dupeL(){

        var idCpTL = charIDToTypeID( "CpTL" );

            executeAction( idCpTL, undefined, DialogModes.NO );

        }

    1 reply

    Chuck Uebele
    Community Expert
    Chuck UebeleCommunity ExpertCorrect answer
    Community Expert
    October 27, 2018

    This is a script that I wrote for someone else with the same issue. It will copy and merge an adjustment layer with all the other layers, so all the layers will have the adjustment layer applied to them and can then be exported. Make sure you make a copy of your file first! And select the adjustment layer before running the script.

    #target photoshop

    var doc = activeDocument;

    var adjL = doc.activeLayer

    for(var i = adjL.parent.layers.length-1;i>0;i--){

        doc.activeLayer = adjL.parent.layers;

        var nextL = doc.activeLayer

        if(nextL.name == adjL.name){break;}

        if(nextL.typename !='LayerSet'){

            try{

                doc.activeLayer = adjL

                dupeL ();

                var tempL = doc.activeLayer

                tempL.move(nextL,ElementPlacement.PLACEBEFORE);

                mergeL ();

                }

            catch(e){

                tempL.remove()

                }

            }

      

        }

    function mergeL(){

        var idMrgtwo = charIDToTypeID( "Mrg2" );

            var desc5 = new ActionDescriptor();

        executeAction( idMrgtwo, desc5, DialogModes.NO );

        }

    function dupeL(){

        var idCpTL = charIDToTypeID( "CpTL" );

            executeAction( idCpTL, undefined, DialogModes.NO );

        }

    kevinh61866897
    Participating Frequently
    October 27, 2018

    Worked Great thanks!