make the images round border in imagemagick

498 Views Asked by At

I have a group of image with a specifc width and height.Now I want all the images with a round border. So can someone tell me how to make batch render round border of all the images in imagemagick, I am using php. Any help or suggestions will be highly appreciable.

1

There are 1 best solutions below

0
On

You just have to create a foreach that covers all files that need to be converted using a line like:

$imageWidth = 800;
$imageHeight = 600;
$borderSize = 20;
foreach($files as $file)
{
  exec('convert -size '.$imageWidth.'x'.$imageHeight.' xc:none -draw "roundRectangle 0,0 '.$imageWidth.','.$imageHeight.' '.$borderSize.','.$borderSize.'" -fill white '.$file.' -compose SrcIn -composite +compress out-'.file);
}

Probably you'll want to check the image size file by file.