Development: Adobe Photoshop script – optimizeMyImages

This script resizes, formats and saves a batch of images from the selected folder to the JPEG format to a specified folder.


The images are proportionally resized to either the maximum width or maximum height (depending on which is greater). If an image is smaller the the maximum width and height, it is not resized. (The max width and max height are set as constants in the script)

The images are converted to RGB.

The images are saved as medium-high quality JPEGs. If the image is already a JPEG, it is not converted. If the image is not a JPEG, it is saved as a JPEG.

The images are closed.


  • The MAX_WIDTH and MAX_HEIGHT constants are set in the script


PDFs are not supported


  • TIFs and PSDs may sometimes throw a save dialog at you. In this case, you’re forced to save a copy of the image, as cancelling the save dialog breaks the script execution.

Planned changes

  • If possible, disable prompts and dialogs (such as Save As)
  • Initial prompt upon running the script which gives user options to select max width, max height and colour mode options



Tools used: JavaScript, Adobe Scripting Engine, Adobe Photoshop