Snippets - With php

Snippets index page

NOTE: Most of the IM snippets have been tested on IM version 6.3.5 There may be some differences if you are using the code on other versions.

Apply rounded corners to an image - IM Forum 19/6/2008

Add rounded corners to an image.

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

For more examples and information check out the main Imagemagick section.

Batch file View

Check size before resizing View

Dividing an image View

Fonts Installed view View

Get image data into a variable 1 View

Get image data into a variable 2 View

Gravity option View

New image size in variable View

Row of images View

Setup Information View

Use an array View

Warhol effect View