5 Replies Latest reply on Mar 6, 2016 11:25 AM by mirza5313

    add another blend mode (Multiply) on script

    mirza5313 Level 1


      I have an existing automation script but I need to change it very slightly to add another blend mode (Multiply). It wont work. So I will attach the script and can you please edit to make it work.

      I just need ability to add another blend mode to it,.

      here is my script

      app.displayDialogs = DialogModes.NO;



      var TemplateFile = File.openDialog ("Please select a template :", "*.psd");

      var DesignsFolder = Folder.selectDialog("Please select Designs folder :");



      //var TemplateFile =File("/F/Work/Brothel/PSscript_Tshirt/example with darkened layer.psd");

      //var DesignsFolder =Folder("/F/Work/Brothel/PSscript_Tshirt/Designs/");



      preferences.typeUnits = TypeUnits.PIXELS;

      preferences.rulerUnits = Units.PIXELS;




      var DocRef = activeDocument; 



      var Rectangle = DocRef.activeLayer;

      var Rectangle = DocRef.channels.getByName("PASTE HERE");

      var Selection = DocRef.selection.load(Rectangle);

      var Bound = DocRef.selection.bounds ;



      PosX =  Bound[0];

      PosY =  Bound[1];

      DimX =  Bound[2] - Bound[0];

      DimY =  Bound[3] - Bound[1];



      var DesignsList = DesignsFolder.getFiles("*.psd"| "*.jpg"| "*.jpeg");



      var Win = new Window('dialog', 'BendMode :');



          Win.size = [150,150];

          Win.btnPnl = Win.add('panel', undefined, 'Build it');



          Win.btnPnl.rb1 = Win.btnPnl.add('radiobutton', undefined, 'Darken');

          Win.btnPnl.rb2 = Win.btnPnl.add('radiobutton', undefined, 'Normal');

          Win.btnPnl.rb3 = Win.btnPnl.add('radiobutton', undefined, 'Lighten');



             Win.btnPnl.rb1.onClick = function()




             Win.btnPnl.rb2.onClick = function()




             Win.btnPnl.rb3.onClick = function()








      function Exe(Val){



          for(I=0; I < DesignsList.length ; I++ ){



              var TempDocRef = activeDocument;

              var N = TempDocRef.name

              TempDocRef.resizeImage(DimX,DimY, undefined, undefined);



              if(TempDocRef.activeLayer.isBackgroundLayer == true){











          function PasteANDSave(N){


              var Selection = DocRef.selection.load(Rectangle);



              if(Val == 1){

                  DocRef.activeLayer.blendMode  = BlendMode.DARKEN;

              }else if(Val == 2){

                  DocRef.activeLayer.blendMode  = BlendMode.NORMAL;

              }else if(Val == 3){

                  DocRef.activeLayer.blendMode  = BlendMode.LIGHTEN;



              DocRef.resizeImage("1000px", DocRef.height /(DocRef.width/1050) + "px",undefined, undefined);

              var JpegOptions = new JPEGSaveOptions();

              JpegOptions.quality = 12;

              DocRef.saveAs ( new File(DesignsFolder + "/result_" + N ), JpegOptions);


              DocRef.activeHistoryState = DocRef.historyStates[0] ;




        • 2. Re: add another blend mode (Multiply) on script
          JJMack Most Valuable Participant

          I answered that for the other user.  It is a batch script for populating a single image collage template.  I find several problems with that script.  You may want  to look at my Photo Collage Toolkit for photoshop.  You would just need to rename you Alpha channel "PASTE HERE" to "Image 1" or duplicate it with that name. The Template also needs to have a Photoshop Background layer then my script would be able to populate your template.  You would also need to add layer styles to the preferences in my preference script for those blend mode as a layer style. So you can select the blending mode for the image layer.  The Image layer would be a smart object layer. The embedded object a copy of your image file the would be sized for the image location without distortion and be masked to the correct shape.  You will have additional option creating templates. All would be done from the Script Dialog.




          Photo Collage Toolkit


          Photoshop scripting is powerful and I believe this package demonstrates this A video showing a 5 image collage PSD template  being populates with images:


          The package includes four simple rules to follow when making Photo Collage Template PSD files so they will be compatible with my Photoshop scripts.

          1. Size the photo collage templates for the print size you want - width, height and print DPI resolution.
          2. Photo collage templates must have a Photoshop background layer. The contents of this layer can be anything.
          3. Photo collage templates must have alpha channels named "Image 1", "Image 2", ... "Image n".
          4. Photo collage templates layers above the background layers must provide transparent areas to let the images that will be placed below them show through.


          There are fifteen scripts in this package they provide the following functions:

          1. HelpPhotoCollageToolkit.jsx - Online Help
          2. TestCollageTemplate.jsx - Used to test a Photo Collage Template while you are making it with Photoshop.
          3. CollageTemplateBuilder.jsx - Can build Templates compatible with this toolkit's scripts.
          4. LayerToAlphaChan.jsx - Used to convert a Prototype Image Layer stack into a template document.
          5. InteractivePopulateCollage.jsx - Used to interactively populate Any Photo Collage template. Offers most user control inserting pictures and text.
          6. ReplaceCollageImage.jsx - use to replace a populated collage image Smart Object layer with an other image correctly resized and positioned.
          7. ChangeTextSize.jsx - This script can be used to change Image stamps text size when the size used by the populating did not work well.
          8. PopulateCollageTemplate.jsx - Used to Automatically populate a Photo Collage template and leave the populated copy open in Photoshop.
          9. BatchOneImageCollage.jsx - Used to Automatically Batch Populate Collage templates that only have one image inserted. The Collage or Image may be stamped with text.
          10. BatchMultiImageCollage.jsx - Used to Automatically Batch Populate Any Photo Collage template with images in a source image folder. Easier to use than the interactive script. Saved collages can be tweaked.
          11. PasteImageRoll.jsx - Paste Images into a document to be print on roll paper.
          12. BatchPicturePackage.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder.  Images Rotates for best fit.
          13. BatchPicturePackageNoRotate.jsx - Used to Automatically Batch Populate Any Photo Collage template with an image in a source image folder.
          14. PopulatePicturePackage.jsx - Used to Automatically populate a Photo Collage template Fill with the same single image and leave the populated copy open in Photoshop.
          15. PCTpreferences.jsx - Edit This File to Customize Collage Populating scripts default setting and add your own Layer styles.


          Documentation and Examples

          • 3. Re: add another blend mode (Multiply) on script
            mirza5313 Level 1

            Hello Mack thank you very much for prompt reply...


            can you please tell me that how to add blend more multiply on my script?

            • 4. Re: add another blend mode (Multiply) on script
              JJMack Most Valuable Participant

              I posted the script in the other thread. IMO that script has problems.  Photoshop Script Change Blend Mode

              • 5. Re: add another blend mode (Multiply) on script
                mirza5313 Level 1

                oky thanks i will check on that thread