Snippets - With php
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.
Check size before resizing - Anthony 25/6/2008
This will check the image size before running the resize command.
<?php// original image$input = "input.jpg";// Get the size of the image$size = getimagesize( $input );// If the width or height is larger than 200 carry on with the resizingif ( ( $size[0] > '200' ) or ( $size[1] > '200' ) {exec("convert $input -resize 200x200 output.jpg");}?>
For more examples and information check out the main Imagemagick section.
Batch file ViewCheck 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