COLOR SHIFT

This tutorial covers several options for changing the colors in an image using PHP with Image Magick from the command line. Some of these functions have been covered elsewhere but I have included them here for comparison.
<?
$IN="SGdoor.jpg";
$SHIFT="-channel R -50% -channel G -threshold 100% -channel B -threshold 50%";
$OUT="SGdoorTH.jpg"; exec ("/usr/bin/convert $IN $SHIFT $OUT");
?>
ORIGINAL
THRESHOLD
<?
$IN="SGdoor.jpg";
$SHIFT="-size 1x1 xc:'rgb(200,0,200)' -fx '1-(1-v.p{0,0})*(1-u)'";
$OUT="SGdoorCFX.jpg";
exec ("/usr/bin/convert $IN $SHIFT $OUT");
?>
ORIGINAL
FX
<?
$IN="SGdoor.jpg";
$SHIFT=" -fill 'rgb(200,0,200)' -tint 100%";
$OUT="SGdoorTNT.jpg";
exec ("/usr/bin/convert $IN $SHIFT $OUT");
?>
ORIGINAL
TINT
<?
$IN="SGdoor.jpg";
$SHIFT="-compose Multiply -bordercolor 'rgb(255,0,255)' -border 0x0";
$OUT="SGdoorCPM.jpg";
exec ("/usr/bin/convert $IN $SHIFT $OUT");
?>
ORIGINAL
COMPOSITE COLOR
<?
$IN="SGdoor.jpg";
$SHIFT="-channel green -negate";
$OUT="SGdoorNR.jpg";
exec ("/usr/bin/convert $IN $SHIFT $OUT");
?>
ORIGINAL
NEGATE CHANNEL
<?
$IN="SGdoor.jpg";
$SHIFT="-fill 'rgb(255,0,255)' -colorize 50%";
$OUT="SGdoorCLZ.jpg";
exec ("/usr/bin/convert $IN $SHIFT $OUT");
?>
ORIGINAL
COLORIZE
<?
$IN="SGdoor.jpg";
$SHIFT="-size 1x2 gradient:darkslateblue-magenta -fx 'v.p{0,0}*u+v.p{0,1}*(1-u)'";
$OUT="SGdoorGDFX.jpg";
exec ("/usr/bin/convert $IN $SHIFT $OUT");
?>
ORIGINAL
GRADIENT FX
<?
$IN="SGdoor.jpg";
$SHIFT="-size 1x2 gradient:darkslateblue-magenta -fx 'v.p{0,1}+(v.p{0,0}-v.p{0,1})*u^4'";
$OUT="SGdoorGDFX2.jpg";
exec ("/usr/bin/convert $IN $SHIFT $OUT");
?>
ORIGINAL
GRADIENT FX2
<?
$IN="SGdoor.jpg";
$SHIFT="-channel magenta -fx 'v.p{0,1}+(v.p{0,0}-v.p{0,1})*u'";
$OUT="SGdoorCHFX.jpg";
exec ("/usr/bin/convert $IN $SHIFT $OUT");
?>
ORIGINAL
CHANNEL FX
Apply colors of one image
to another using clut
<?
$IN="SGdoor.jpg";
$SHIFT="\( netscape.gif \) -clut";
$OUT="SGdoorCLUT.jpg";
exec ("/usr/bin/convert $IN $SHIFT $OUT");
?>
ORIGINAL
CLUT
Recolor
The first three numbers of the matrix
is the color formula for the 'red' channel.
the next for 'green' and so on
The following will swap the red
and blue channel color,but leave
the green channel as is
More on recolor from Sally.
<?
$IN="SGdoor.jpg";
$SHIFT="-recolor '0 0 1 0 1 0 1 0 0'";
$OUT="SGdoorRCL1.jpg";
exec ("/usr/bin/convert $IN $SHIFT $OUT");
?>
ORIGINAL
RECOLOR
<?
$IN="SGdoor.jpg";
$SHIFT="-recolor '.2 .5 .3 .2 .5 .3 .2 .5 .3'";
$OUT="SGdoorRCLG.jpg";
exec ("/usr/bin/convert $IN $SHIFT $OUT");
?>
ORIGINAL
RECOLOR GRAY


Below are a zip of a sample Color shift script plus a Color shift form. You will need to make a temp directory as it outputs images to that Directory. There is also a text version of the form if you prefer that to the zip.

COLOR_SHIFT ZIP

COLOR_SHIFT TEXT