ResizeToLimit 0.2

This script resizes an image such that:

So for example, suppose you run the script and specify an image height and width of 500 (i.e. a square).  If the image you are resizing has a width of 200 and a height of 300, the new size of the image will be 333x500.  Both the width and height are 500 or less and the aspect ratio of 2/3 is unchanged.

Note, if you specify the height or width as 0, no limit will be used for that dimension.  In the example above, resizing a 200x300 image with a width of 500 and a height of 0 will result in an image that is 500x750.  The width has been limited to 500 but the height has not.

This script can be used in batch to resize a collection of images to be a uniform size.  It can also be used to create a set of thumbnails that maintain the image aspect ratios.  Before you use this script in batch, you should edit it and change the default height and width values to the values you desire.

Installation instructions:

Download the file.  Unzip it and place the contents in your Scripts-Restricted folder.

To Run Interactively:

Open or create a new image.  Select the ResizeToLimit script in the scripts list and press play.   If the Interactive Script Playback button is set, the script will prompt you for maximum height and width values to use.  If the script is not run interactively, the default values of 200x200 will be used.  You can edit the script and change these values.

To Run in Batch:

Select the File / Batch / Process menu item. Press the Script Browse button and select the ResizeToLimit script.  Select the file names or directory you wish to resize.  Press either the Start or Select All buttons to run the script. If the 'Run script in silent mode' box is checked, the script will use the default values for height and width (200x200).  You can edit the script and change these values. If the silent mode box is not checked, the script will prompt you for the maximum height and width values for each image.

Using ResizeToLimit:

If you are a script writer, you may use the ResizeToLimit routine in your own scripts.  Cut and paste the routine (look for the start and end markers) onto the end of your script.  You can then call ResizeToLimit anywhere you want in your own script.  The arguments to ResizeToLimit should follow the example in the ResizeToLimit script.  Note, you don't need to prompt the user for the height and width if you already know them.  Just specify the height and width directly in the call to ResizeToLimit.

Change history:

Changes in 0.1 (07/10/03):

Changes in 0.2 (07/26/03):


Last modified 07/26/2003 10:30:52 PM