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 18

Storage type

Pixel storage type.

More information to follow.

Stretch

Set a type of stretch style for fonts.

Stretch example

$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

$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

$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

$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

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

Swap

Swap the positions of two images in the image sequence.

Swap example

$cmd = "$input1 $input +swap -gravity center". 
" -composite ";  
exec("convert $cmd swap.jpg");

Swirl

Swirl image pixels about the center.

Swirl example

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

Taint

Mark the image as modified even if it isn't.

More information to follow.

Text font

Font for writing fixed-width text.

More information to follow.

$cmd = "$input -fill white -pointsize 40". " -gravity center -text-font Arial ".
" -annotate +0+0 \"Text font\""; 
exec("convert $cmd text-font.jpg");

Texture

Name of texture to tile onto the image background.

Texture example

$cmd = " -size 313x260 pattern:BRICKS ".
" $input -gravity center -composite ". "-resize 213 ";
exec("convert $cmd texture.jpg");
 

( The bricks texture is one built into Imagemagick. )

Threshold

Apply simultaneous black/white threshold to the image.

Threshold example

$cmd = "$input -channel red -threshold 25%";
exec("convert $cmd threshold.jpg");

Thumbnail

Resize and thumbnail have the same effect but thumbnail strips the EXIF data etc.

Thumbnail example

$cmd = "$input -thumbnail 50% "; 
exec("convert $cmd thumbnail.jpg");

( Later versions do not strip the colour profile. )

Tile

Set the tile image used for filling a subsequent graphic primitive.

Tile example

// Resize the boots image first to fit image
exec("convert $input1 -thumbnail 50x50 temp.png");
// Tile the image
$cmd = "-tile temp.png $input ";  
exec("composite $cmd tile.jpg");

( As this example is using composite rather than convert the images are in reverse order. )