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.
Make a copy of an image (or images).
$cmd = "$input ( +clone -thumbnail x480 -write 480_wide.jpg". " +delete ) -thumbnail \"100x100!\" "; exec("convert $cmd clone.jpg");
Replace the channel values in the first image using each corresponding channel in the second image as a color lookup table.
$cmd = "$input2 $input3 -clut"; exec("convert $cmd clut.jpg");
( Replace the channel values in the first image using each corresponding channel in the second image as a color lookup table. )
Fully define the look of each frame of an GIF animation sequence, to form a 'film strip' animation.
More information to follow.( See the Layers page. )
Apply a color correction to the image
$cmd = "$input -color-matrix ". " \" 1.5 0.0 0.0 0.0, 0.0, -0.157 ". " 0.0 1.5 0.0 0.0, 0.0, -0.157 ". " 0.0 0.0 1.5 0.0, 0.0, -0.157 ". " 0.0 0.0 0.0 1.0, 0.0, 0.0 ". " 0.0 0.0 0.0 0.0, 1.0, 0.0 ". " 0.0 0.0 0.0 0.0, 0.0, 1.0\""; exec("convert $cmd color-matrix.jpg");
Colorize the image by an amount specified by value using the color specified by the most recent -fill setting.
$cmd = "$input -fill Blue -colorize 30 "; exec("convert $cmd colorize.jpg");
( Colorize the image by an amount specified by value using the color specified by the most recent -fill setting. )
Set the preferred number of colors in the image.
$cmd = "$input -colors 10 "; exec("convert $cmd colors.jpg");
Set the image colorspace.
$cmd = "$input -colorspace gray"; exec("convert $cmd colorspace.jpg");
Combine one or more images into a single image.
$cmd = " separate-0.png separate-1.png separate-2.png". " -channel RGB -combine "; exec ("convert $cmd combine.png");
Embed a comment in an image.
The comment is in the IPTC or EXIF data$cmd = "$input -comment \"Comment imbeded in image\" "; exec("convert $cmd comment.jpg");
Mathematically and visually annotate the difference between two images.
$cmd = "$input annotate.jpg -metric RMSE -compare "; exec("convert $cmd compare.jpg");
( Visually display the difference. You can get a numerical output as well. )
Perform complex mathematics on an image sequence
Perform alpha composition on the current image sequence.
$cmd = "$input $input1 -gravity center". " -composite "; exec("convert $cmd composite.jpg");
( You can use the same methods of overlaying as compose.
Note the images are in the oposite order to compose. )