8 Replies Latest reply on Jun 6, 2014 8:57 AM by fireinureeyes

    Need help from a developper for a simple script ;)

    shadeoner

      Hi !

       

      First of all i'm French, so please excuse my bad english !

       

      I'm a photographer, actualy working on a artist residency project of "slit scan" urban landscapes, and my goal is to get my hands on a script cuting and pasting columns of multiples images sources into one final image.

       

      If someone of you can help me with this, please contact me !

       

      Thank you

       

      ----Stéphane

        • 1. Re: Need help from a developper for a simple script ;)
          c.pfaffenbichler Level 9

          Please elaborate, maybe post an example or sketch to illustrate what you have in mind.

          • 2. Re: Need help from a developper for a simple script ;)
            hilukasz Level 1

            something like processing might actually be faster for this.

            1 person found this helpful
            • 3. Re: Need help from a developper for a simple script ;)
              shadeoner Level 1

              Well, i want to do some slit scan pictures using a image folder. I take shots like timelapse, for many hours.

              The goal is to develop a script to help build the final image.

               

              yestarday night, i have coded a quick and dirty script that creates a blank picture, then load every folder images, take the good slice from each file, then paste in good place into the final picture. It works but i never coded a line of javascript before. so it's basic, without UI, and the parameters have to be changed in the code itself. not really sexy

              • 4. Re: Need help from a developper for a simple script ;)
                NightSkyGuy Level 1

                Have you tried: File -> Automate -> Photomerge ?

                 

                As I understand slit scanning, it's essentially the same process as creating a panoramic image.

                 

                Photoshop's photomerge engine may not work well here... but it's worth a try.

                • 5. Re: Need help from a developper for a simple script ;)
                  shadeoner Level 1

                  hello Hilukasz,

                   

                  i think you're right, processing is dedicated for this kind of stuf, but photoshop is a lot more flexible for the file formats, and also, for example to feather a selection in one line of code

                  If i remeber good, there's a slit scanning code example using webcam in all the latest versions.

                  • 6. Re: Need help from a developper for a simple script ;)
                    shadeoner Level 1

                    Hello NightSkyGuy,

                     

                    never coded a line of javascript before, so be gentle

                    Anyways, it works.

                     

                    What i want to do now is to add UI pannel to choose different parameters, etc...

                     

                     

                    -------------------------------------------------------------------------------

                     

                     

                     

                    // photoshop 1er plan

                    app.bringToFront();

                     

                    var strtRulerUnits = app.preferences.rulerUnits;

                    app.preferences.rulerUnits = Units.PIXELS;

                    var docRef = app.documents.add(3840, 5760, 72, null, NewDocumentMode.RGB, DocumentFill.WHITE);

                     

                    app.preferences.rulerUnits = strtRulerUnits;

                     

                     

                    var orig=0; // pour fixer l'origine si besoin

                    var largeur = 3840;

                    var hauteur = 5760;

                    var time = 0;

                     

                     

                    var inputFolder = Folder.selectDialog("Dossier contenant la suite d'images");

                    //var inputFolder = Folder( 'F:/SLIT2' );

                     

                    var fileList = inputFolder.getFiles(/\.(nef|cr2|crw|dcs|raf|arw|orf|dng|jpg|tif|psd| eps|png|bmp)$/i);

                     

                     

                     

                    nbrfiles= fileList.length;

                     

                     

                    var epaisseur = Math.round ( largeur / fileList.length ) ; //calcul de l'épaisseur de la tranche en px arrondi

                     

                    //var epaisseur = 20;

                     

                    alert( "le dossier contient : "+ fileList.length + "fichiers" + " -> tranches de : " + epaisseur + " Pixels" );

                     

                     

                     

                    for( var time = 0; time < fileList.length; time++){

                     

                    app.open( fileList[time] );

                     

                    selRegion = Array(

                    Array(orig+(time*epaisseur), 0),

                    Array(orig+(epaisseur*time)+epaisseur, 0),

                    Array(orig+(epaisseur*time)+epaisseur, hauteur),

                    Array(orig+(time*epaisseur), hauteur));

                     

                    app.activeDocument = app.documents[1];

                     

                    app.activeDocument.selection.select(selRegion);

                    app.activeDocument.selection.copy();

                    app.activeDocument.selection.clear;

                    app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

                     

                    app.activeDocument = app.documents[0];

                     

                    app.activeDocument.selection.select(selRegion);

                    app.activeDocument.paste();

                    app.activeDocument.selection.clear;

                    app.activeDocument.flatten();

                     

                     

                    }

                     

                    docRef = null;

                    • 7. Re: Need help from a developper for a simple script ;)
                      Chuck Uebele Adobe Community Professional & MVP

                      There are several ways to create a UI.  I use the old method.  How to create them and samples are in the extendscript toolkit SDK, but here's a brief sample

                       

                      var dlg = new Window('dialog','Title for your UI here'); //This creates the main UI object.

                      dlg.gp = dlg.add('group'); //this creates a group so you can put other elements in it by either row or column

                      dlg.gp.bx1 = dlg.gp.add('checkbox',undefined,'Check box 1'); //adds a checkbox.

                      //by using "undefined" PS adjust the positioning of the checkbox - much easier!

                      dlg.gp.bx1.value = true;//sets the value of the check box to true.

                      dlg.gp.eTxt1 = dlg.gp.add('edittext',undefined,'Edit text value'); //adds a edittext field so you can change your variables.

                      dlg.btn = dlg.add('button',undefined,'Okay');//creates an okay button to start the script.

                      dlg.btn.onClick = function(){dlg.close()};//creates a function to do something if you click the button. 

                      //add more lines of code to assign variables and error checking if you want to.

                      dlg.show();//you need this to have the UI show up.

                      There's a lot more, but that's a start.  Creating the UI actually takes the most amount of time.

                      • 8. Re: Need help from a developper for a simple script ;)
                        fireinureeyes

                        Hey shadeoner,

                         

                        i'm no developer, but i needed to create something like timelapse slices, because i wanted to put the timelapse i created into one picture (example below). At first i had no idea how, but with your code i was able to make it. Maybe my code will help you to create also the "slit scan" you wanted, if you haven't already . It's also my next goal, at least to try it. Thank you for inspiration.

                         

                         

                        app.bringToFront();

                         

                        var inputFolder = Folder.selectDialog("Locate the folder containing the image sequence:");

                        var fileList = inputFolder.getFiles(/\.(nef|cr2|crw|dcs|raf|arw|orf|dng|jpg|tif|psd| eps|png|bmp)$/i);

                        //selecting image sequence

                         

                         

                        var strtRulerUnits = app.preferences.rulerUnits;

                        app.preferences.rulerUnits = Units.PIXELS;

                         

                        app.open( fileList[0] )

                        app.activeDocument = app.documents[0];

                        var width = app.documents[0].width;

                        var height = app.documents[0].height;

                        app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

                        //getting the dimensions

                         

                         

                        var docRef = app.documents.add(width, height, 72, null, NewDocumentMode.RGB, DocumentFill.WHITE);

                        app.preferences.rulerUnits = strtRulerUnits;

                        //creating a new document

                         

                         

                        var thickness = (width / fileList.length);

                        //calculating the thickness of the stripes

                         

                         

                        alert( "Folder contains "+ fileList.length + " files, " + height + " x " + width + " each. The slices will be " + thickness + " thick." );

                         

                        for( var i = 0; i < fileList.length; i++){

                         

                          app.open( fileList[i] );

                         

                          selRegion = Array(

                          Array((i*thickness), 0),

                          Array((thickness*i)+thickness+1, 0),

                          Array((thickness*i)+thickness+1, height),

                          Array((i*thickness), height));

                         

                          app.activeDocument = app.documents[1];

                         

                          app.activeDocument.selection.select(selRegion);

                          app.activeDocument.selection.copy();

                          app.activeDocument.selection.clear;

                          app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

                         

                          app.activeDocument = app.documents[0];

                         

                          app.activeDocument.selection.select(selRegion);

                          app.activeDocument.paste();

                          app.activeDocument.selection.clear;

                          //app.activeDocument.flatten(); //flattening image layers

                        }

                         

                        docRef = null;


                         

                        timelapse.jpg