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.
Adjust the level of an image using the provided dash seperated colors.
$cmd = " $input -level-colors #2a3e0b,#ff5f79"; exec("convert $cmd level_colors.jpg");
Set the resource limit.
$cmd = "$input -limit memory 200mb -motion-blur 0x8+30"; exec("convert $cmd limit.jpg");
Linear with saturation stretch.
$cmd = "$input -linear-stretch 1,2% "; exec("convert $cmd linear_stretch.jpg");
Linewidth is depreciated use strokewidth.
$cmd = "$input -stroke black -linewidth 5". " -fill none -draw \"circle 120,80 120,15 \" "; exec("convert $cmd linewidth.jpg");
Rescale image with seam-carving.
$cmd = "$input -liquid-rescale \"75x100%\!\" "; exec("convert $cmd liquid_rescale.jpg");
( Not built in extra code needs to be built into IM. )
List some operator options
All the gravity optionsecho "All the gravity options"; system("convert -list gravity"); echo "";
Specify the format for the debug log.
First few lines of output$array = array(); echo ""; $cmd = " -debug coder -log \"%u %m:%l %e\" $input "; exec("convert $cmd log.jpg 2>&1", $array); echo "";
".print_r($array)."
"; echo "
( Array ( [0] => 0.016u jpeg.c:336 [images/input.jpg] JPEG Trace: "Start of Image" [1] => 0.016u jpeg.c:336 [images/input.jpg] JPEG Trace: "JFIF APP0 marker: version 1.01, density 72x72 1" [2] => 0.016u jpeg.c:667 Profile: exif, 11764 bytes )
Add Netscape loop extension to your GIF animation.
$cmd = " -dispose previous -delay 5 -size 213x160 xc:none -page +0+0 $input4". " -page +10+15 $input4 -page +20+30 $input4 -page +30+45 $input4". " -page +40+60 $input4 -page +50+75 $input4 -page +60+90 $input4". " -page +70+75 $input4 -page +80+60 $input4". " -page +90+45 $input4 -page +100+30 $input4 -page +110+15 $input4". " -page +120+0 $input4 -loop 0"; exec("convert $cmd loop.gif");
When comparing images, de-emphasize pixel differences with this color.
More information to follow.Display image using a specified type.
More information to follow.( Used with animations.
+map generate a colour map
-map use a colour map
)
Sets the color for -frame
$cmd = "$input -mattecolor lightbrown -frame 10x10+0+0"; exec("convert $cmd mattecolor.jpg");
Apply a median filter to the image.
$cmd = "$input -median 1"; exec("convert $cmd median.jpg");