Imagemagick operators page: 6

Deskew

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

Deskew example
Another Deskew example
<?php 
$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
<?php 
$cmd 
"$input -despeckle ";
exec("convert $cmd despeckle.jpg");
 
?>

Direction

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

Direction example
Another Direction example
<?php 
$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.

<?php 
$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
<?php 
$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
<?php 
$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
<?php 
$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
<?php 
$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 )

Duplicate

Duplicate an image one or more times.