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.
Adaptively blur pixels, with decreasing effect near the edges.
$cmd = "$input -adaptive-blur 0x2 "; exec("convert $cmd adaptive-blur.jpg");
Resize the image using data-dependent triangulation.
$cmd = "$input -adaptive-resize 133x100 "; exec("convert $cmd adaptive-resize.jpg");
Adaptively sharpen pixels, with increasing effect near edges.
$cmd = "$input -adaptive-sharpen 5x0.5 "; exec("convert $cmd adaptive-sharpen.jpg");
Join images into a single multi-image file.
$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. )
Gives control of the alpha/matte channel of an image.
$cmd = "$input15 -alpha on"; exec("convert $cmd alpha_on.png"); $cmd = "$input15 -alpha off"; exec("convert $cmd alpha_off.png");
Annotate an image with text - angle option
$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. )
Enable/Disable of the rendering of anti-aliasing pixels when drawing fonts and lines.
$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. )
Enable/Disable of the rendering of anti-aliasing pixels when drawing fonts and lines.
$cmd = "-size 213x160 xc:NavajoWhite +antialias -stroke black". " -strokewidth 5 -draw \"line 10,10 200,150 \" "; exec("convert $cmd antialias_off.jpg");
Join current images vertically or horizontally.
$cmd = "clone.jpg clone.jpg -append"; exec("convert $cmd append_vert.jpg");
( Now one image consisting of the two original images. )
Join current images vertically or horizontally.
$cmd = "clone.jpg clone.jpg +append"; exec("convert $cmd append_horiz.jpg");
( Now one image consisting of the two original images. )
Lessen (or intensify) when adding noise to an image.
$cmd = "$input -attenuate 4 +noise Impulse"; exec("convert $cmd attenuate.jpg");
Decrypt a PDF with a password.
$cmd = "input.pdf -authenticate passwd"; exec("convert $cmd authenticate.jpg");