Skip navigation
Currently Being Moderated

Batch processing images with different dimensions

Apr 23, 2012 12:31 PM

Tags: #batch_actions

Hi all!


I've been trying to do this for a while and I'm stumped, so I'd like to know if it's even possible. I'm trying to fathom out how to create an action which…


  • Takes a jpg
  • draws a shape
  • masks the image
  • adds another shape


So I can batch process a ton of images.


I managed to do something like what I'm after but the thing I'm having trouble with is that the original images will have different dimensions.


I have attached (via link) an example image which would be the original (start.jpg), one which would be the desired end result (done.jpg) and the .psd


IF there needs to be a step in the middle of the action where I need to intervene and resize the flat image slightly to fit the canvas it'll still save a load of time.


I know that opening and saving will be taken care of using the batch feature and the result only needs to be a jpg.


Any input will be welcomed!


Here are the working files -


Many thanks

  • Currently Being Moderated
    Apr 23, 2012 7:13 PM   in reply to mikeebee

    I think just the fact the images wouldn't be the same size would keep you from getting accurate results from any action.You might be able to transform the edges using a percentage value, but again there would be way too many varialbes.

    Mark as:
  • Trevor Dennis
    5,898 posts
    May 24, 2010
    Currently Being Moderated
    Apr 23, 2012 7:20 PM   in reply to Shan-Dysigns

    Could you use Percentage values?  You can find the center and place Guides with 50pc for instance, and use that as the start point.


    [EDIT]  I see I was beaten to it.

    Mark as:
  • Currently Being Moderated
    Apr 24, 2012 2:04 AM   in reply to mikeebee

    I will have to create a landscape action and a portrait action and manually sort the original images.

    Scripting can unlike straight Actions include conditionals and therefore process landscape and portrait images differently.

    What are the exact steps of your Action?

    Mark as:
  • Currently Being Moderated
    Apr 24, 2012 2:43 AM   in reply to mikeebee

    This Script would select one or another Action depending on whether the active image is wider than high.

    You have to insert the correct names for the appropriate Action and Action Set, though.

    // 2012, use at your own risk;
    #target photoshop
    if (app.documents.length > 0) {
    var myDocument = app.activeDocument;
    if (myDocument.width > myDocument.height) {
              app.doAction("Canvas landscape", "bfunk")
    else {
              app.doAction("Canvas portrait", "bfunk")
    Mark as:
  • Currently Being Moderated
    Apr 24, 2012 3:04 AM   in reply to mikeebee

    If you want to give it a try, paste the previously posted text into a new file in ExtendScript Toolkit (part of Photoshop’s installation, Applications/Utilities/Adobe Utilities/ExtendScript Toolkit CS4 or /Applications/Utilities/Adobe Utilities-CS5/ExtendScript Toolkit CS5) and save it as a jsx-file into Photoshop’s Presets/Scripts-folder.

    After restarting Photoshop the Script should be available under File > Scripts and can be assigned a Keyboard Shortcut directly, recorded into an Action, (in CS4 and CS5) be used in a Configurator-Panel or started from ExtendScript Toolkit directly.

    Mark as:
  • Currently Being Moderated
    Apr 24, 2012 3:05 AM   in reply to mikeebee

    Of course there is the question: What about square images (height is equal to width)?

    Currently if would be treated as portrait.

    Mark as:
  • Currently Being Moderated
    Apr 24, 2012 10:56 AM   in reply to mikeebee

    That's an interesting action, but I thought the expected output was different than what this action produces. First, I didn't think image cropping would have been ok (maybe the OP expects this or is ok with cropping). Secondly, I kept getting caught up in how the right edge was going to actually be skewed (as decreasing in size perspectively off into the distance). This action appears to just visually trick the eye (again which may be what the OP wanted or is ok with). Like I said, just that aspect alone is where I kept getting stuck in how this would be possible without some manual manipulation.


    If you take this image and perform this action, you will see how the right side doesn't actually get skewed (as I thought was part of the visual effect wanted). Still, this action is quite nice.

    Mark as:
  • Currently Being Moderated
    Apr 28, 2012 10:30 AM   in reply to mikeebee

    You’re welcome.

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points