3 Replies Latest reply on Nov 19, 2016 9:19 PM by Chuck Uebele

    pattern fill action

    xaviers56858660

      i am fashion designer . i have 5000 pattern image (160*160) jpg format .that all image convert to 1920*1080 image format. using  automate action batch or Photoshop Scripting?

      rrr.jpg

        • 1. Re: pattern fill action
          Chuck Uebele Adobe Community Professional & MVP

          Try this script. Open one ofthe pattern files first.

           

          #target photoshop
          app.preferences.rulerUnits = Units.PIXELS;
          var doc = activeDocument;
          
          doc.activeLayer.isBackgroundLayer = false;
          
          canvasSize (1080, 160);
          
          for(var i=0;i<6;i++){
              dupLayer ();
              doc.activeLayer.translate(160,0)
              }
          
          doc.flatten();
          doc.activeLayer.isBackgroundLayer = false;
          canvasSize (1080, 1920);
          
          for(var i=0;i<11;i++){
              dupLayer ();
              doc.activeLayer.translate(0,160)
              }
          doc.flatten();
          
          function dupLayer(){
              var id3 = charIDToTypeID( "CpTL" );
              executeAction( id3, undefined, DialogModes.NO );    
              }//end function duplayer
          
          function canvasSize (horNum, VertNum){
              var idCnvS = charIDToTypeID( "CnvS" );
                  var desc4 = new ActionDescriptor();
                  var idWdth = charIDToTypeID( "Wdth" );
                  var idPxl = charIDToTypeID( "#Pxl" );
                  desc4.putUnitDouble( idWdth, idPxl, horNum);
                  var idHght = charIDToTypeID( "Hght" );
                  var idPxl = charIDToTypeID( "#Pxl" );
                  desc4.putUnitDouble( idHght, idPxl, VertNum );
                  var idHrzn = charIDToTypeID( "Hrzn" );
                  var idHrzL = charIDToTypeID( "HrzL" );
                  var idLeft = charIDToTypeID( "Left" );
                  desc4.putEnumerated( idHrzn, idHrzL, idLeft );
                  var idVrtc = charIDToTypeID( "Vrtc" );
                  var idVrtL = charIDToTypeID( "VrtL" );
                  var idTop = charIDToTypeID( "Top " );
                  desc4.putEnumerated( idVrtc, idVrtL, idTop );
                  var idcanvasExtensionColorType = stringIDToTypeID( "canvasExtensionColorType" );
                  var idcanvasExtensionColorType = stringIDToTypeID( "canvasExtensionColorType" );
                  var idBckC = charIDToTypeID( "BckC" );
                  desc4.putEnumerated( idcanvasExtensionColorType, idcanvasExtensionColorType, idBckC );
              executeAction( idCnvS, desc4, DialogModes.NO );
              }
          
          2 people found this helpful
          • 2. Re: pattern fill action
            johnandersonpixel

            hi helpful one but whether i want to know if it is possible to ask a user input for duplicating how many times both vertical and horizontally if possible let me know how to make that

            • 3. Re: pattern fill action
              Chuck Uebele Adobe Community Professional & MVP

              You would need to make a UI first so that a user could input the numbers they wanted. Then you can change line 9 in the above code to enter the number horizontal. You would change the number 6 to the variable you used in your UI. Same with line 18. Replace the 11 with the variable from your UI for the number of patterns to place vertically.