TRANSFORM

This tutorial covers some transformation functions using PHP with Image Magick from the command line.
IM COMMANDPARAMETERS
-flipnone
-flopnone
-transposenone
-transversenone
-background 'hex' -rotate degreesrotates and colors in background
-roll +H+Vroll image horizontally or vertically
-background 'hex' -shear HxVshear horizontally or vertically and fill in background color
-splice 10x10+50+75splice wxh of the splice lines +w+h pixels on the image where lines should go
-shave WxHshave of number of pixels either on both sides or top and bottom. Cannot do just one side.
ORIGINAL IMAGE
<?
$IN="papercut.jpg";
$TRANSFORM="-flop";
$OUT="papercutflop.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");
?>
FLOP
lt;?
$IN="papercut.jpg";
$TRANSFORM="-flip";
$OUT="papercutflip.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");
?>
FLIP
lt;?
$IN="papercut.jpg";
$TRANSFORM="-transpose";
$OUT="papercuttransp.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");
?>
TRANSPOSE
lt;?
$IN="papercut.jpg";
$TRANSFORM="-transverse";
$OUT="papercuttransv.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");
?>
TRANSVERSE
<?
$IN="papercut.jpg";
$TRANSFORM="-background '#997766' -rotate 30";
$OUT="papercutrotate30.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");
?>
ROTATE
<?
$IN="papercut.jpg";
$TRANSFORM="-roll +0+30";
$OUT="papercutrollV.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");?>
?>
ROLL VERTICALLY
<?
$IN="papercut.jpg";
$TRANSFORM="-roll +50+0";
$OUT="papercutrollH.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");?>
?>
ROLL HORIZONTALLY
<?
$IN="papercut.jpg";
$TRANSFORM="-roll +50+30";
$OUT="papercutrollHV.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");?>
?>
ROLL H AND V
<?
$IN="papercut.jpg";
$TRANSFORM="-background '#997766' -shear 0x50";
$OUT="papercutshearV.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");
?>
SHEAR VERTICALLY
<?
$IN="papercut.jpg";
$TRANSFORM="-background '#997766' -shear 50x0";
$OUT="papercutshearH.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");
?>
SHEAR HORIZONTALLY
<?
$IN="papercut.jpg";
$TRANSFORM="-background '#997766' -splice 10x10+50+75";
$OUT="papercutsplice.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");
?>
SPLICE
<?php
$IN="papercut.jpg";
$TRANSFORM="-background '#663300' -splice 30x30+0+0";
$OUT="papercutsplicelt.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");
?>
SPLICE ADD HALF BORDER
<?php
$IN="Examples/papercutsplicelt.jpg"; $TRANSFORM="-shave 20x20";
$OUT="papercutshavelt.jpg";
exec ("/usr/bin/convert $IN $TRANSFORM $OUT");
?>
SHAVE


Below are a zip of a sample transform script plus a transform form. There is also a text version of the form if you prefer that to the zip.

TRANSFORM ZIP

TRANSFORM TEXT