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 6

Descend

Obtain image by descending window hierarchy.

More information to follow.


( Not used with php )

Deskew

Straighten an image. A threshold of 40% works for most images.

Deskew example

Another Deskew example

$text = "ImageMagick is an external program that can be called from php.";
// Create the skewed image for the example
$cmd = " -size 200x150 -background white -pointsize 25 ".
" -gravity NorthWest caption:\"$text\" ";
exec("convert $cmd -rotate 2 text.png");
// Deskew the text
exec("convert text.png -deskew 80% deskew.jpg");

Despeckle

Reduce the speckles within an image.

Despeckle example

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

Direction

Render text right-to-left or left-to-right.

Direction example

Another Direction example

$text = "ImageMagick is an external program that can be called from php.";

$cmd = " -size 200x150 -background NavajoWhite ".
" -fill Black -gravity center ".  
" -direction right-to-left caption:\"$text\" ";

exec("convert $cmd directionr.jpg");

$cmd = " -size 200x150 -background NavajoWhite ".
" -fill Black -gravity center ".  
" -direction left-to-right caption:\"$text\" ";

exec("convert $cmd directionl.jpg");

( There seems to be a problem with the right to left version but it might work properly with a font designed for this direction? )

Displace

Shift image pixels as defined by a displacement map.

More information to follow.

$cmd = "$input -displace 17x7 ";  
exec("convert $cmd displace.jpg");
    

Display

Specifies the X server to contact.

Not used with php.

Dispose

Define the GIF disposal image setting for images that are being created or read in.

Dispose example

$cmd = " -dispose none -delay 50". 
" -size 213x160 xc:none". 
" -page +0+0 $input4 -page +8+18 $input4". 
" -page +18+33 $input4 -page +28+48 $input4". 
" -page +38+63 $input4 -page +48+82 $input4". 
" -page +58+93 $input4 -page +68+78 $input4". 
" -page +78+63 $input4 -page +88+48 $input4". 
" -page +98+33 $input4 -page +108+18 $input4". 
" -page +123+0 $input4 -loop 0"; 
exec("convert $cmd dispose.gif");
 

Dissimilarity threshold

Maximum RMSE for subimage match (default 0.2).

More information to follow.

Dissolve

Dissolve an image into another by the given percent.

Dissolve example

$cmd = "-dissolve 10% $input1 $input ";  
exec("composite $cmd dissolve.jpg");
    

Distort

Distort an image, using the given method and its required arguments.

See distort

Distribute cache

Launch a distributed pixel cache server.

Dither

Apply a Riemersma or Floyd-Steinberg error diffusion dither to images.

Dither example

$cmd = "$input -dither Riemersma "; 
exec("convert $cmd minus_dither.jpg");

( Apply a Riemersma or Floyd-Steinberg error diffusion dither to images when general color reduction is applied via an option, or automagically when saving to specific formats. This enabled by default.

Turned on by default. )

Dither

Dither example

$cmd = "$input +dither "; 
exec("convert $cmd plus_dither.jpg");

( Turn off -dither )

Draw arc

Annotate an image with one or more graphic primitives.


( See Draw )