Skip navigation
Currently Being Moderated

Complex Script For Automating Conversion of High Res Images to Web

Apr 22, 2009 6:32 AM

I use Actions in Photoshop (currently using CS4) all the time, but have never delved into the scripting capabilities, so please forgive me if these questions are obvious.

The basic description of my project is simply creating web images in jpg format, from our library of high-res print images.

We're going to have one folder with a copy of all the images we need to convert. File types range from EPS, TIF, PSD and JPG.

The challenges (to me) are:

1. these images vary in orientation of being tall or wide; I need the greater of the dimensions, whether it be height or width, to be 400 pixels; and then I need canvas added to the other dimension to make the image a perfect 400 x 400 square. I don't know how to, or if I can, make PS choose the greater of the dimensions, to set it to 400 px.

2. some of these images have clipping paths; i need to use those paths to erase the background in the photos; the names of these clipping paths are not the same in every image.

So, the basic flow of the script would be open the file; set the max dimension to 400 px; add white canvas to fill the other dimension and make that also 400px; use the image's clipping path if it has one to erase the image's background; save for web as jpg, appending "-400" to the end of filename (but before the ".jpg"); set size to 115 and save for web, appending "-115" to the name; set size to 80 and save for web, appending "-80" to the name.

  • Currently Being Moderated
    Apr 22, 2009 11:54 AM   in reply to Sean Larkin

    You can use Image Processor (Scripts:Image Processor) to resize to fit in a specific size. It will resize to fit inside those dimensions. You can save out as a PSD, Jpeg and/or TIFF. You can also specify an action to run, create an action to use the clipping path as a mask on your layer. You might need a few extra steps to make sure the action works with all of your images (e.g. merge visible before masking in case there are multiple layers).


    If the image processor doesn't get you all of the way to where you want, or the output isn't what you need (e.g. gif, png), you can set the output to PSD, and run another batch action on the resulting files to finish the job.

    Mark as:
  • Currently Being Moderated
    Apr 22, 2009 1:16 PM   in reply to Sean Larkin

    I have modifed one of my scripts that should do everything for you, it can be download here...

    Mark as:
  • Currently Being Moderated
    Apr 22, 2009 2:09 PM   in reply to Sean Larkin

    The problem with filename could be a setting within Photoshop, try this...

    Open a document in Photoshop then ..
    File - Save for Web & Devices
    at the right hand side of the preset dropdown box there is a downarrow click this and select edit output settings.
    Keep clicking next until you see "Filename Compatibility" and untick "Mac OS 9"

    No it isn't based on "Image Processor" it was based on my Save For Web CS4.

    The script will need to have a fairly major change to add those options, so I will have a look at it tomorrow Sean.

    Mark as:
  • Currently Being Moderated
    Apr 22, 2009 3:22 PM   in reply to Sean Larkin

    A new version has been up uploaded to PS-Scripts Sean this now creates a folder of each selected folder with the name of "JPEG" and it has the option of Include Sub Folders.

    Mark as:
  • Currently Being Moderated
    Apr 30, 2009 9:11 AM   in reply to Sean Larkin

    Nice work Sean, except Progressive should still be 3 not 4. This is a value that is used if the Progessive checkbox is ticked and how the jpeg is created.

    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