public static function frameImage(&$image, $color, $width, $height)
{
// Need to jump through these hoops in order to preserve any
// transparency.
// @TODO Imagick::clone is deprecated as of 3.1.0. For H6 use the clone
// keyword instead.
try {
$border = $image->clone();
$border->borderImage(new ImagickPixel($color), $width, $height);
$border->compositeImage($image, Imagick::COMPOSITE_COPY, $width, $height);
$image->clear();
$image->addImage($border);
} catch (ImagickPixelException $e) {
throw new Horde_Image_Exception($e);
} catch (ImagickException $e) {
throw new Horde_Image_Exception($e);
}
$border->destroy();
}