These scripts come with the Moving Images application, and you can use the application to install the scripts as well as installing smig and the Moving Images Launch Agent.
The following scripts can be used for processing images. Each of the scripts takes the command line option "--help" which will list the options and provide an example. The scripts all use the ruby scripting language and are plain text files, so if you would like to write your own you can use these to get yourself started. You can install these scripts using the MovingImages application.
In the brief descriptions that follow I'm assuming that you have: used the "cd" command to change to the directory containing the scripts, that the folder containing your source images is a folder called SourceImages on your Desktop, and that the processed image files are saved to a folder called DestinationImages on your desktop. If you are going to use these scripts a lot I would recommend updating your unix path to point to the folder containing the scripts.
Many of the scripts have a quality option. This allows you to specify a quality versus image file compression trade off. This option is mostly relevant when saving the image as a jpeg image where the more you compress the image the worse the saved image looks, but that the file size is significantly smaller. This options is called --quality.
The scripts addshadow and customaddshadow will save the generated image files as public.png files, whereas the createanimation script will save the animation as a gif file. The other scripts will save the generated image files in the same format as the original file format.
Add a shadow
The following command will process all the files in the SourceImages folder with the file extension .JPG. The script will add a shadow to the image which is offset to the bottom right of the image. The color of the shadow is a medium dark grey with no transparency. If you don't specify the alpha value, a default alpha value of 1 (fully opaque) is used. The processed images are all saved in the folder DestinationImages as png files and have the file extension .png.
This script will create a gif animation from the list of files provided, and a specified frame delay time. The create animation script also takes an optional argument --loopcount. The following example specifies a frame delay time of 0.5 seconds, and leaves the loopcount option unspecified, which leaves it at its default value of 0, meaning that the animation repeats indefinitely.
The custom add shadow script differs from the addshadow script in two ways. With the custom add shadow script you can specify the shadow width for each edge of the image, top, left, bottom, right. If you don't specify a width for an edge, then the width takes the default value of 0.0. Secondly, the shadow gradates from being partially transparent at the edge of the drawn image, to being fully transparent at the edge of the canvas. This is similar to a shadow drawn around windows on OS X. The processed images are all saved in the folder DestinationImages as png files and have the file extension .png.
The custom crop script allows you to crop the image by different amounts from each edge of the image. If you don't specify a crop width for an edge, then the crop width takes the default value of 0.0. The output file format is the same as the input file format. The following example crops from the bottom and top edges, copies the metadata from the original image to the cropped image, and saves the images as public.jpeg since the original images are public.jpeg images.
The custom pad script allows you to pad the image by different amounts from each edge of the image. If you don't specify a pad width for an edge then the pad width takes the default value of 0.0. The output file format is the same as the input file format. The following example pads the image on the left and right edges with a dark blue color, and saves the images as public.jpeg since the original images are public.jpeg images.
The scale image script has three options for scaling the image, --scale, --scalex, and --scaley. At least one needs to be specified. If you use --scale, then you shouldn't specify --scalex, and --scaley. If you don't specify --scale, then you specify --scalex or --scaley, or both. The scale image script takes two different quality options. The export quality option as described above, and a second option which is the interpolation quality. The interpolation quality option is used when the image is actually scaled. The following script scales the images by a factor of 0.5, with a medium interpolation quality. The script lists the files as they are processed, displays the configuration options and sets the export quality level to 0.8.
The set aspect ratio script allows you to adjust the size of an image to achieve a specific aspect ratio. This is achieved either by padding or cropping the image. The default option is to pad. If you want to achieve the desired aspect ratio by cropping, then you specify the --crop option. The following command sets the aspect ratio of 4 to 3. The --crop option is set. If you don't set the padding option, then you need to also specify a color for the padding.
You do not provide any options when running the drawimage script. To run the script, all you have to type is the full path to the script.
The script will display the open file dialog, and you can use that to select an image file. Once selected the script imports the image into the MovingImages Launch Agent (MILA) and gets the image width and height. Some maths is then done so that the image can be drawn to a bitmap context where the longest edge is 512 pixels, while keeping the same aspect ratio as the original image. The bitmap context is created, a debug window that displays the contents of the bitmap context is shown, and the scaled image is drawn to the bitmap context. The script then pauses for 10 seconds while the image is displayed and then exits.
The script will display the open file dialog, and you can use that to select an image file. Once selected, the script imports the image into the MILA. The script then saves the metadata associated with the first image in the image file to a folder called junk on your Desktop, and then opens the saved metadata file in your default text editor.