Rubblewebs

THESE CODES ARE PROVIDED FOR AN EXAMPLE OF HOW TO USE IMAGEMAGICK WITH PHP. CARE SHOULD BE TAKEN WHEN ACCEPTING USER INPUT.

I TAKE NO RESPONSABILTY FOR ANY PROBLEMS THAT MAY OCCURE WHEN USING ANY OF THIS CODE.

IT IS UP TO YOU TO SECURE THE CODE AND VALIDATE USER INPUT.

Imagemagick operators page 1

Adaptive blur

Adaptively blur pixels, with decreasing effect near the edges.

Adaptive blur example

$cmd = "$input -adaptive-blur 0x2 "; 
exec("convert $cmd adaptive-blur.jpg");
 

Adaptive resize

Resize the image using data-dependent triangulation.

Adaptive resize example

$cmd = "$input -adaptive-resize 133x100 "; 
exec("convert $cmd adaptive-resize.jpg");

Adaptive sharpen

Adaptively sharpen pixels, with increasing effect near edges.

Adaptive sharpen example

$cmd = "$input -adaptive-sharpen 5x0.5 "; 
exec("convert $cmd adaptive-sharpen.jpg");

Adjoin

Join images into a single multi-image file.

Adjoin example

$cmd = "adaptive-blur.jpg antialias_off.jpg".
" adaptive-sharpen.jpg -adjoin ";
exec("convert $cmd adjoin.gif");

( You can have a gif type animation or a pdf multipage file. On certain files this is automatic and if the file does not support multiple images the files will be out put individualy. )

Affine

Set the drawing transformation matrix for combined rotating and scaling.

See distort

Alpha

Gives control of the alpha/matte channel of an image.

Alpha example

Another Alpha example

$cmd = "$input15 -alpha on";
exec("convert $cmd alpha_on.png");

$cmd = "$input15 -alpha off";
exec("convert $cmd alpha_off.png");

Alpha discrete

Treat the alpha channel independently (do not blend).

Another Alpha discrete example

Annotate

Annotate an image with text - angle option

Annotate example

Another Annotate example

$cmd = "$input -fill white -pointsize 30 -gravity center ". 
" -annotate -40 \"Angle annotate\""; 
exec("convert $cmd annotate_angle.jpg");

$cmd = "$input -fill black -pointsize 40". 
" -gravity center -annotate +0+0 \"Annotate\"". 
" -fill white -annotate +2+2 \"Annotate\""; 
exec("convert $cmd annotate.jpg");
  

( 3 O'clock is zero degrees and clockwise is positive. )

Antialias

Enable/Disable of the rendering of anti-aliasing pixels when drawing fonts and lines.

Antialias example

$cmd = "-size 213x160 xc:NavajoWhite -antialias ". 
"-stroke black -strokewidth 5 ". 
"-draw \"line 10,10 200,150 \" "; 
exec("convert $cmd antialias_on.jpg");

( On by default and so -antialias does not need to be specified. )

Antialias off

Enable/Disable of the rendering of anti-aliasing pixels when drawing fonts and lines.

Antialias off example

$cmd = "-size 213x160 xc:NavajoWhite +antialias -stroke black". 
" -strokewidth 5 -draw \"line 10,10 200,150 \" "; 
exec("convert $cmd antialias_off.jpg");
    

Append

Join current images vertically or horizontally.

Append example

$cmd = "clone.jpg clone.jpg -append"; 
exec("convert $cmd append_vert.jpg");

( Now one image consisting of the two original images. )

Append horizontal

Join current images vertically or horizontally.

Append horizontal example

$cmd = "clone.jpg clone.jpg +append"; 
exec("convert $cmd append_horiz.jpg");

( Now one image consisting of the two original images. )

Attenuate

Lessen (or intensify) when adding noise to an image.

Attenuate example

$cmd = "$input -attenuate 4 +noise Impulse"; 
exec("convert $cmd attenuate.jpg");

Authenticate

Decrypt a PDF with a password.

$cmd = "input.pdf -authenticate passwd"; 
exec("convert $cmd authenticate.jpg");