Rubblewebs

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.

Imagemagick operators page 7

Duplicate

Duplicate an image one or more times.

Duplicate example

$cmd = "$input -duplicate 3 +append -resize 250x "; 
exec("convert $cmd duplicate.jpg");

Edge

Detect edges within an image.

Edge example

$cmd = "$input -edge 2 "; 
exec("convert $cmd edge.jpg");

Emboss

Emboss an image.

Emboss example

$cmd = "$input -emboss 15 "; 
exec("convert $cmd emboss.jpg");

Encipher

Encipher pixels for later deciphering by -decipher.

Encipher example

$cmd = "$input -encipher images/passkey.txt "; 
exec("convert $cmd encipher.png");

( The key is in the text file or can be another image. You need to use an image format that does not recompress the image e.g. png )

Encoding

Specify the text encoding.

Encoding example

$cmd = "-size 213x160 -background NavajoWhite ".  
"-fill black -gravity center -encoding utf8 ".
" caption:\"Encoding\" ";  
exec("convert $cmd encoding.jpg");

Endian

Specify endianness (MSB or LSB) of the image.

More information to follow.

$cmd = "$input -endian: lsb ";  
exec("convert $cmd endian.jpg");

( Use +endian to revert to unspecified endianness. )

Enhance

Apply a digital filter to enhance a noisy image.

Enhance example

$cmd = "$input -enhance"; 
exec("convert $cmd enhance.jpg");

Equalize

Perform histogram equalization on the image channel-by-channel.

Equalize example

$cmd = "$input -equalize"; 
exec("convert $cmd equalize.jpg");

Evaluate

Evaluate example

$cmd = "$input -matte -channel A ".
" -evaluate set 20% +channel"; 
exec("convert $cmd evaluate.jpg");
  

Evaluate sequence

Alter channel pixels by evaluating an arithmetic, relational, or logical expression over a sequence of images.

Exit

Stop processing at this point

Another Exit example

Extent

Set the image size and offset.

Extent example

$cmd = "$input -background NavajoWhite". 
" -gravity center -extent 223x200 "; 
exec("convert $cmd extent.jpg");
 

Extract

Extract the specified area from image.

Extract example

$cmd = "-size 266x200 -extract 100x100+50+50". 
" $input"; 
exec("convert $cmd extract.jpg");
 

Family

Set a font family for text.

Family example

$cmd = "-size 213x160 -background NavajoWhite -fill black". 
" -gravity center -pointsize 30 -family AvantGarde -font AvantGarde-DemiOblique caption:\"Family\" "; 
exec("convert $cmd family.jpg");