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.
Opaque using fill for the replacement colour and -fuzz to select a range.
$cmd = "$input -fuzz \"20%\" -fill orange -opaque red"; exec("convert $cmd opaque.jpg");
Dither the image using a pre-defined ordered dither threshold map specified, and a uniform color map with the number of levels per color channel.
More information to follow.Specify orientation of a digital camera image.
$cmd = "$input -orient bottom-left"; exec("convert $cmd orient.jpg");
Set the size and location of an image on the larger virtual canvas.
More information to follow.Set the size and location of an image on the larger virtual canvas.
More information to follow.set each pixel whose value is less than |epsilon| to -epsilon or epsilon (whichever is closer) otherwise the pixel value remains unchanged.
Efficiently determine image characteristics.
40$output = exec("identify -ping -format \"%[fx:h*0.2]\" $input"); echo $output;
( This can speed up the identify process. )
Set the font size to be used with draw, annotate etc.
$cmd = "$input -font font/DRAGM.ttf -pointsize 55 ". "-fill white-gravity south -annotate 0,0 \"Draw text\" "; exec("convert $cmd pointsize.jpg");
Polaroid effect.
$cmd = " -caption \"A Hibiscus\" $input -background black -polaroid 5"; exec("convert $cmd polaroid.png");
( -polaroid = set the angle +polaroid = random angle between -15 and +15 degrees. - Background controls the shadow colour; save as png for transparent background. )
Combines multiple images according to a weighted sum of polynomials; one floating point weight (coefficient) and one floating point polynomial exponent (power) for each image expressed as comma separa
Reduce the image to a limited number of color levels.
$cmd = "$input -posterize 3"; exec("convert $cmd posterize.jpg");