Return to the tutorials
Return to the scripting


HDR Shop Scripting - Batch Processing

The main use of HDRShop scripts is to apply image operations to multiple images. The simplest version of this is to apply an operation to all the open images.
Here is a sample script for applying a 2 pixel Gaussian Blur to all open images.
var img;
for(i = 0; i < GetImageCount(); i++)
{
	img = GetImage(i);
	img.GaussianBlur(2);
}
Instead of gaussian blur there are many other operations that you can use. Here is a partial list of available functions in the Image class.
bool Save(filename, (opt) format)
Image Duplicate()
void Copy(img)
void Close(force)
void Resize(width, height, (opt) options)
void Crop(left, top, width, height)
void Clear(r, g, b)
void Scale(r, g, b)
void Offset(r, g, b)
void Exp(r, g, b)
void Power(r, g, b)
void ThresholdLower(r, g, b)
void ScaleAdd(img, r, g, b)
void ApplyColorMatrix(mat)
void Add(img)
void Mult(img)
c[] Sum(left, top, width, height)
void GaussianBlur(sigma)
void MotionBlur(angle, pixels)
void StarBlur(params)
void Pan(x, y)
void FlipVertical()
void FlipHorizontal()
void Rotate90CW()
void Rotate90CCW()
void Vignette(inner, outer)
void Randomize()
void Quantize()
void Convolve(img)
In general whenever a function can be passed a r g b color value such as for Clear or Scale, the function can also be passed a 3 element array that contains the floating point color values. In the above code the size of the blur is hard-coded as two. To make the code more generic it would be nice to get some form of user-input to change these values. This is the subject of the next tutorial.

Return to the scripting
Return to the tutorials