Snippets - Optimize

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.

Clone - Anthony 14/6/2008

This code reads in the image, copys it with +clone, resizes and saves it. Then resizes and saves the next size. The part of the code within the ( ) has no effect on any of the other part of the code.

  1. <?php
  2. $cmd "input.jpg ( +clone -resize 600x600 -write first_save.jpg +delete )".
  3. " -resize 60x60 thumbnail.jpg ";
  4. exec("convert $cmd");
  5. ?>

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

Clone View