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.

Check size before resizing - Anthony 25/6/2008

This will check the image size before running the resize command.

  1. <?php
  2. // original image
  3. $input "input.jpg";
  4. // Get the size of the image
  5. $size getimagesize$input );
  6. // If the width or height is larger than 200 carry on with the resizing
  7. if ( ( $size[0] > '200' ) or ( $size[1] > '200' ) {
  8. exec("convert $input -resize 200x200 output.jpg");
  9. }
  10. ?>

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