Snippets - Resize and crop

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.

Speed up jpg resize - Anthony 22/6/2008

Defining the size of the jpg when loading it will speed up the resizing process. This is done by adding the -size option.

  1. <?php 
  2. exec("convert -size 250x90 input.jpg -resize 250x90 output.jpg"); 
  3. ?>

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

Clone View

Crop an image View

Crop an image into pieces View

Dividing an image View

Keep minimum image size View

New image size in variable View

Resize if over certain size View

Resize keep aspect ratio. View

Resize no aspect ratio. View

Speed up jpg resize View