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.
Display (cooccurrence matrix) texture measure features for each channel in the image in each of four directions (horizontal, vertical, left and right diagonals) for the specified distance.
( Used with identify )
Implements the forward discrete Fourier transform (DFT).
$cmd = "$input3 -fft "; exec("convert $cmd fft.png");
( Uncompressed image formats only. )
Color to use when filling a graphic primitive.
$cmd = "$input -fill blue -fuzz \"10%\"". " -opaque \"#7b1216\" "; exec("convert $cmd fill.jpg");
Filter to be used during resize.
Check this page for some examples of the filters( The standard filter is Lanczos. )
This is a simple alias for the -layers method "flatten".
$cmd = "-size 213x160 -background NavajoWhite -fill black". " -gravity center caption:\"Flatten\" -flatten"; exec("convert $cmd flatten.jpg");
Floodfill the image with color at the specified offset.
$cmd = "$input -fill Blue -fuzz \"25%\" -floodfill +80+30 ". " \"#7b1216\""; exec("convert $cmd floodfill.jpg");
( Using -fuzz to floodfill pixels which only change by a small amount. )
Reflect the image in the horizontal direction.
$cmd = "$input -flop "; exec("convert $cmd flop.jpg");
Set the font to be used with draw, annotate etc.
$cmd = "$input -font handsean.ttf -pointsize 40 ". "-fill white -gravity south -annotate 0,0 \"Draw text\" "; exec("convert $cmd font.jpg");
( You can use a font recognised by Imagemagick or provide the path to a font. )
Output formatted image characteristics.
$time_stamp = exec("identify -format \"%[EXIF:DateTime]\" $input"); $cmd = "$input -pointsize 18 -gravity north ". " -fill black -annotate +2+2 \"Date: $time_stamp\" ". " -fill white -annotate +0+0 \"Date: $time_stamp\" "; exec("convert $cmd format.jpg"); $pi = exec("convert null: -format \"PI=%[fx:atan(1)*4]\" info:"); echo $pi; // Result - PI=3.14159
A frame around the image
$cmd = "$input -mattecolor NavajoWhite -frame 10x10+3+3"; exec("convert $cmd frame.jpg");
( Set the frame color with -mattecolor. The image size will increase by the frame size. )
Apply a function to channel values.
$cmd = "$input -channel R -function Sinusoid 3,-90,.2,.7"; exec("convert $cmd Sinusoid.jpg");
( Add another example http://www.imagemagick.org/Usage/color/#curves )
Fuzz can be used to select a range of colours and in the example is used with transparent.
$cmd = "$input -fuzz 15% -transparent \"#7b1216\" "; exec("convert $cmd fuzz.png");
( Image displayed on a grey checkerboard to show the transparent areas.
IS IT ? )