Skip to main content
Participant
April 30, 2018
Question

Photo shop action or script that runs based on the dimension of image

  • April 30, 2018
  • 3 replies
  • 409 views

I work for a small sign company and we print from photoshop every day.  We currently have actions that save our print settings for each file.  The problem is that we have 1000's of signs with many different sizes.  So we have to save print settings for each file using our actions.  I am wondering if there is a way to run actions based on the size or the image.  For instance if we open a 12" x 12" image, photoshop would know to run our 12" x 12" Action and apply our print settings for paper size and all of that.  Does anyone know if there is a way to do this?     We would love to get some more automation into our process.

Thanks to anyone that can help.

This topic has been closed for replies.

3 replies

Participant
May 1, 2018

One possible idea you can do is use aspect ratio/orientation/name filters in Adobe bridge, highlight the files and go to Tools > Batch/image processor

and run your actions from there. This way you can batch process these before you need to use them.

Another idea is

From the actions panel, you can also add conditionals in your steps, so say you filtered out 2 pre-determined sizes. You can do

if document is square, run square action
else do this action.

if landscape do that, else do portrait print settings.

Participant
May 1, 2018

I had thought about batch processing them before use.  That was my main idea actually.  I did not know I could filter them with bridge though.  Thanks for the tips!

Chuck Uebele
Community Expert
Community Expert
May 1, 2018

Moving post to the Photoshop Scripting Forum.

Photoshop Scripting

Participant
May 1, 2018

Appreciate the help.  This definitely points me in the right direction.

Chuck Uebele
Community Expert
Community Expert
May 1, 2018

Yes, that's doable, but how many different print settings or sign sized do you have?

Participant
May 1, 2018

Quite a few.  We do a lot of laser cut work and sublimation so the sizes vary.  Even in our standard sizes have about 20.  I am sure this makes it harder haha.

Chuck Uebele
Community Expert
Community Expert
May 1, 2018

Not really know how things are set up, here's a simple script that will take the size of a file in inches, and then run an action. Trouble is that you would have to populate the switch statement with each file size and each corresponding action that you want to run.

#target photoshop

app.preferences.rulerUnits = Units.INCHES;

var doc = activeDocument

var docSize = parseInt(doc.width) +'X' + parseInt(doc.height);

switch (docSize){

    case '12X12':

        runAction ('YourActionSetHere', '12" X 12"');//add appropiate name for the action and action set you're using

        break;

    case '14X14':

        runAction ('YourActionSetHere', '14" X 14"');

        break;

    }

function runAction(actionSet, actionName){

    var idPly = charIDToTypeID( "Ply " );

        var desc4 = new ActionDescriptor();

        var idnull = charIDToTypeID( "null" );

            var ref1 = new ActionReference();

            var idActn = charIDToTypeID( "Actn" );

            ref1.putName( idActn, actionName );

            var idASet = charIDToTypeID( "ASet" );

            ref1.putName( idASet, actionSet );

        desc4.putReference( idnull, ref1 );

    executeAction( idPly, desc4, DialogModes.NO );  

    }