Is there a way to create a new image transform 'onAfterInstall()' of a plugin? As the title suggests, I would like my plugin to generate a new image transform automatically (with a few settings) when the plugin is installed. 

The purpose is to avoid my plugin from crashing if a transform hasn't already been generated yet (or doesn't have the same handle names).

Thanks,

Mark
Have a look at the method actionSaveTransform in the AssetTransformsController.

The code you actually need for your onAfterInstall would be like this:

// Only create if it doesn't exist (by handle)
if (is_null(craft()-&gt;assetTransforms-&gt;getTransformByHandle($handle))) {
    $transform = new AssetTransformModel();
    $transform-&gt;id = $transformId;
    $transform-&gt;name = $name;
    $transform-&gt;handle = $handle;
    $transform-&gt;width = $width;
    $transform-&gt;height = $height;
    $transform-&gt;mode = $mode;
    $transform-&gt;position = $position;
    $transform-&gt;quality = $quality;
    $transform-&gt;format = $format;

    if(craft()-&gt;assetTransforms-&gt;saveTransform($transform)) {
        // Success
    }
    else {
        // Error
    }   
}