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.
Shear the image along the x-axis and/or y-axis.
$cmd = "$input -background NavajoWhite -shear 15x15"; exec("convert $cmd shear.jpg");
( The colour of the parts of the canvas exposed by the image moving are set by -background. )
Increase the contrast without saturating highlights or shadows.
$cmd = "$input -sigmoidal-contrast \"3x20%\" "; exec("convert $cmd sigmoidal_contrast.jpg");
Set the width and height of the image.
$cmd = "-size 213x160 xc:NavajoWhite -stroke black ". "-strokewidth 1 -fill none -draw \"circle 106,80 106,10 \" "; exec("convert $cmd size.jpg");
Simulate a pencil sketch.
$cmd = "$input -colorspace gray -sketch 0x10+135"; exec("convert $cmd sketch_simple.jpg");
It does more than just append with a overlap. It appends images with shape, and allowing one shape to fit into another shape.
convert -pointsize 72 -background none \ -fill red label:A -fill blue label:V \ +smush 0 av_smush.png
Negate all pixels above the threshold level.
$cmd = "$input -solarize \"40%\" "; exec("convert $cmd solarize_percent.jpg");
( Effect using percent. )
Color the given image using the specified points of color, and filling the other intervening colors using the given methods.
$cmd = "-size 100x100 xc: -sparse-color Voronoi ". " \"30,10 red 10,80 blue 70,60 lime 80,20 yellow\" ". "-fill white -stroke black ". "-draw \"circle 30,10 30,12 circle 10,80 10,82\" ". "-draw \"circle 70,60 70,62 circle 80,20 80,22\" "; exec("convert $cmd sparse_voronoi.gif");
Splice the current background color into the image.
$cmd = "$input -background NavajoWhite -splice 20x20+133+100"; exec("convert $cmd splice.jpg");
Displace image pixels by a random amount.
$cmd = "$input -spread 10 "; exec("convert $cmd spread.jpg");
Hide watermark within an image.
// Create the message and imbed it into the image $cmd = " -size 150x40 xc:white -fill black -pointsize 20 ". " -gravity center -annotate +0+0 \"Secret message\" miff:- | composite ". " - $input1 -stegano +15+2 message.png"; exec("convert $cmd message.png"); // Recover the message $cmd = "-size 150x40+15+2 stegano:message.png"; exec("convert $cmd stegano.gif");
( If image is modified in anyway the watermark can not be recovered; hence the image needs saving in a format that does not get compressed on saving e.g. png )