Photoshop CS and Scripting

I just discovered that Photoshop CS supports scripting in AppleScript, JavaScript and Visual Basic!  There's a complete type library available for the Visual Basic developer, and you can use either VBScript or full blown Visual Basic.  I'm going to bet that I can also use Visual Studio .NET.  For more information on scripting Photoshop CS, check out the reference documentation in C:\Program Files\Adobe\Photoshop CS\Scripting Guide.

This will solve a challenge I've been having with Photoshop of late.  We gave my grandmother a Ceiva digital picture frame which wants images to fit within 640x480.  The problem this creates for me is automating the resize depeding if your orientation is landscape or portrait.  With landscape images, you want to resize the width to be 640 pixels, while with portrait images you want to resize the height to be 480 pixels.  Photoshop's Actions can't handle this because they don't support conditional logic.  With scripting, howerver, this should be a very straight forward thing to do.

Off to write a script ...

Comments

  • Anonymous
    May 04, 2005
    You can go to file-->automate-->Fit Image and you can specify a max height and width for an image so that it will be resized to fit within those dimensions. That is the easier solution to the batch resizing issue concerning portrait vs. landscape.

  • Anonymous
    June 29, 2005
    Umm.. how does Fit Image constrain the resize conditionally based on portrait or landscape? (hint: it doesn't)

  • Anonymous
    July 07, 2005
    Let me explain... If you have a batch of 4:3 images (ie: 640:480 ratio, but not necessarily those dimensions) that are either portrait or landscape, then if you fit them all to a 640px x 640px square, they'll all come out as 640px x 480px with their portrait/landscape format intact. HTH.

  • Anonymous
    January 30, 2006
    Fit works well as described above.
    I would like to add one more conditional: do not resize if both the width and height of the image are smaller then the “Fit Image constrains” (i.e. the width is less than 640 and the height is less then 480).

    Can this be done in a Photoshop script or does it require the external scripting (AppleScript, JavaScript and Visual Basic)?

  • Anonymous
    May 31, 2009
    PingBack from http://patiochairsite.info/story.php?id=1403

  • Anonymous
    June 01, 2009
    PingBack from http://portablegreenhousesite.info/story.php?id=13417

  • Anonymous
    June 13, 2009
    PingBack from http://gardendecordesign.info/story.php?id=4107