Imagemagick operators page: 17

Sketch

Simulate a pencil sketch.

Sketch example
<?php 
$cmd 
"$input -colorspace gray -sketch 0x10+135"
exec("convert $cmd sketch_simple.jpg");
 
?>

Snaps

Set the number of screen snapshots.

Not used with php.

Solarize

Negate all pixels above the threshold level.

Solarize example
<?php 
$cmd 
"$input -solarize \"40%\" "
exec("convert $cmd solarize_percent.jpg");
 
?>

( Effect using percent. )

Sparse color

Color the given image using the specified points of color, and filling the other intervening colors using the given methods.

Sparse color example
<?php 
$cmd 
"-size 100x100 xc: -sparse-color  Voronoi "
" \"30,10 red 10,80 blue 70,60 lime 80,20 yellow\" "
"-fill white -stroke black "
"-draw \"circle 30,10 30,12 circle 10,80 10,82\" "
"-draw \"circle 70,60 70,62 circle 80,20 80,22\" "
exec("convert $cmd sparse_voronoi.gif");
 
?>

Splice

Splice the current background color into the image.

Splice example
<?php 
$cmd 
"$input -background NavajoWhite -splice 20x20+133+100"
exec("convert $cmd splice.jpg");
 
?>

Spread

Displace image pixels by a random amount.

Spread example
<?php 
$cmd 
"$input -spread 10 "
exec("convert $cmd spread.jpg");
 
?>

Stegano

Hide watermark within an image.

Stegano example
Another Stegano example
<?php 
// Create the message and imbed it into the image
$cmd " -size 150x40 xc:white -fill black -pointsize 20 ".
" -gravity center -annotate +0+0 \"Secret message\" miff:- | composite ".
" - $input1 -stegano +15+2 message.png";  
exec("convert $cmd message.png");  

// Recover the message
$cmd "-size 150x40+15+2 stegano:message.png";
exec("convert $cmd stegano.gif");
 
?>

( If image is modified in anyway the watermark can not be recovered; hence the image needs saving in a format that does not get compressed on saving e.g. png )

Stereo

Composite two images to create a stereo anaglyph.

More information to follow.

Storage type

Pixel storage type.

More information to follow.

Stretch

Set a type of stretch style for fonts.

Stretch example
<?php $cmd "-size 213x160 -background NavajoWhite -fill black"
" -gravity center -pointsize 30 -stretch UltraExpanded -font Arial caption:\"Stretch\" "
exec("convert $cmd stretch.jpg"); ?>

( Is not working! )

Strip

Strip the image of any profiles or comments.

Strip example
<?php 
$cmd 
"$input -resize 100x100 -strip ";  
exec("convert $cmd strip.jpg");
  
?>

( This will reduce the image filesize. )

Stroke

Color to use when stroking a graphic primitive.

Stroke example
<?php 
$cmd 
"-size 213x160 xc:NavajoWhite -stroke black "
"-strokewidth 5 -fill none -draw \"circle 106,80 106,10 \" "
exec("convert $cmd stroke.jpg");
 
?>

Strokewidth

Strokewidth sets the line width.

Strokewidth example
<?php 
$cmd 
"-size 213x160 xc:NavajoWhite -stroke blue "
"-strokewidth 10 -fill none -draw \"circle 106,80 106,10 \" "
exec("convert $cmd strokewidth.jpg");
 
?>

Style

Set a font style for text - limited options

Style example
<?php 
$cmd 
"-size 213x160 xc:NavajoWhite -pointsize 30 -style italic ".
" -draw \"gravity center fill black text 0,0 'Italic' \" "
exec("convert $cmd style.jpg");
  
?>