Apply rounded corners to an image

<?php
// Get the dimensions of the original image
$size = getimagesize('input.jpg');
// Create a rounded corner mask to overlapp the image
$cmd = " -size {$size[0]}x{$size[1]} xc:none -fill white ".
" -draw \"roundRectangle 0,0 {$size[0]},{$size[1]} 15,15\" ".
" input.jpg -compose SrcIn -composite ";
exec("convert $cmd output.png");
?>Add rounded corners to an image.