Back to the snippets index

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.

IM code:

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

// Later versions of Imagemagick use this instead:

exec("convert -define jpeg:size=250x90 input.jpg -resize 250x90 output.jpg");

?>