Skip to main content
Participant
July 1, 2015
Question

Looking for a Script, or Action, or a Preset to divide 24 x 12 in PSD files into two 12 x 12 JPG files

  • July 1, 2015
  • 1 reply
  • 281 views

I am looking for a script, or action, or a preset that I can use to divide 24 x 12 inch PSD files into two 12 x 12 JPG files that will save these jpg files into a folder for uploading to a book printing website.  I'm relatively new to PS so was wondering if anyone could point me in the right direction?   Thanks

This topic has been closed for replies.

1 reply

MR74270
Inspiring
July 2, 2015

I suggest following organigram (process ? My English is really terrible !).

- the user chooses the folder where images have been copied

- a sub-folder is created where cut images must be saved

- if the original image is vertical or square the script creates a top and a bottom 1/2 images (image_T.jpg & image_B.jpg). In the other case left and right components (image_L.jpg & image_R.jpg).

If you need that, I think I can help you. Please confirm before action;

MR74270
Inspiring
July 3, 2015

You can also try this script and adapt it.

// MAC Finder ou WINDOWS Explorer

#target photoshop

app.bringToFront();

var rulerUnit = app.preferences.rulerUnits;

main();

function main(){

    // Selection of the folder where images have been copied

    var inputFolder = Folder.selectDialog("Select the folder where your images have been copied : ");

    var outputFolder = Folder(inputFolder + "/save");

    if (!outputFolder.exists) outputFolder.create();

    var fileList = inputFolder.getFiles(/\.(jpg|jpeg|tif|psd|)$/i);

    // No comment

    app.displayDialogs = DialogModes.NO;

    // Pixels

    app.preferences.rulerUnits = Units.PIXELS;

    // If there are photos in the folder

    if (fileList.length>0)

    {

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

        {

            var docRef = open(fileList);

            var docName  = docRef.name;

            var docName  = docName.substring( 0, docName.indexOf('.') ); //photo26 et photo43

            var docResolution = app.activeDocument.resolution;

            var tl = Array(0, 0); // Top Left

            var tr = Array(inchToPix(12,docResolution),0);

            var br = Array(inchToPix(12,docResolution), inchToPix(12,docResolution));

            var bl = Array(0, inchToPix(12,docResolution));

            var mySelection = Array(tl, tr, br, bl);

            // JPEG options

            var jpg_Options = new JPEGSaveOptions( ); 

            jpg_Options.embedColorProfile = true; 

            jpg_Options.formatOptions = FormatOptions.STANDARDBASELINE; 

            jpg_Options.matte = MatteType.NONE; 

            jpg_Options.quality = 10;

           

            // Cut Image 1 and saves it

            app.activeDocument.selection.select(mySelection);

            app.activeDocument.selection.copy();

            var newDoc1 = app.documents.add(inchToPix(12,docResolution), inchToPix(12,docResolution), docResolution, docName+"_1")

            app.activeDocument = app.documents[1]

            newDoc1.paste();

            newDoc1.flatten();

            newDoc1.saveAs( File(outputFolder + '/' + newDoc1.name + ".jpg" ), jpg_Options, true );

            newDoc1.close(SaveOptions.DONOTSAVECHANGES);

           

            // Cut image 2 and saves it

            app.activeDocument.selection.invert();

            app.activeDocument.selection.copy();

            var newDoc2 = app.documents.add(inchToPix(12,docResolution), inchToPix(12,docResolution), docResolution, docName+"_2")

            app.activeDocument = app.documents[1]

            newDoc2.paste();

            newDoc2.flatten();

            newDoc2.saveAs( File(outputFolder + '/' + newDoc2.name + ".jpg" ), jpg_Options, true );

            newDoc2.close(SaveOptions.DONOTSAVECHANGES);

           

            // Closes the original file

            app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

       }

    }

    // Restores the unit preference of the user

    app.preferences.rulerUnits=rulerUnit;

    alert("Your files are in the subfolder \"../save\"");

}

function inchToPix(valToConvert, docResolution)

{

    return valToConvert * docResolution;

}

Known Participant
July 7, 2015

You can do that with an action. Here is a video showing how I did it.

http://ephotopros.com/photoshop/2015/photoshop-action-to-split-spreads/