This tutorial covers some some color functions using PHP with Image Magick from the command line. |
Change to websafe colors by mapping colors to a color map netscape color cube (use gif map) <? $IN="SGglass.jpg"; $MAP="netscape.gif"; $COLORMAP="-map"; $OUT="SGglassNC.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $MAP $OUT"); ?> | ORIGINAL |
COLOR MAP |
<? $IN="SGglass.jpg"; $MAP="netscape.gif"; $COLORMAP="+dither -map"; $OUT="SGglassNCd.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $MAP $OUT"); ?> | ORIGINAL |
COLOR MAP NO DITHER |
<? $IN="SGfish.jpg"; $COLORMAP="-colors 5"; $OUT="SGfishRC.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $OUT"); ?> | ORIGINAL |
REDUCE COLORS |
<? $IN="SGfish.jpg"; $COLORMAP="+dither -colors 5"; $OUT="SGfishRCD.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $OUT"); ?> | ORIGINAL |
REDUCE COLORS NO DITHER |
<? $IN="SGfish.jpg"; $COLORMAP="-ordered-dither o4x4"; $OUT="SGglassOD4.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $OUT"); ?> | ORIGINAL |
ORDERED DITHER PIXEL |
<? $IN="SGfish.jpg"; $COLORMAP="-ordered-dither h4x4o"; $OUT="SGfishODht4.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $OUT"); ?> | ORIGINAL |
ORDERED DITHER HALFTONE ORTHOGONAL |
<? $IN="SGfish.jpg"; $COLORMAP="-ordered-dither h4x4a"; $OUT="SGfishODht4.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $OUT"); ?> | ORIGINAL |
ORDERED DITHER HALFTONE ANGLED |
<? $IN="SGfish.jpg"; $COLORMAP="-ordered-dither checks"; $OUT="SGfishODht4.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $OUT"); ?> | ORIGINAL |
ORDERED DITHER CHECKS |
<? $IN="SGglass.jpg"; $COLORMAP="-monochrome"; $OUT="SGglassBW.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $OUT"); ?> | ORIGINAL |
BLACK AND WHITE |
<? $IN="SGind.jpg"; $COLORMAP="-posterize 2"; $OUT="SGindPost.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $OUT"); ?> | ORIGINAL |
POSTERIZE |
<? $IN="SGglass.jpg"; $COLORMAP="-colorspace HSB -channel B -separate "; $OUT="SGglassHSB.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $OUT"); ?> | ORIGINAL |
BRIGHT GRAY |
<? $IN="SGglass.jpg"; $COLORMAP="-colorspace YUV -channel R -separate "; $OUT="SGglassYUV.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $OUT"); ?> | ORIGINAL |
DARK GRAY |
<? $IN="SGglass.jpg"; $COLORMAP="-colorspace HSL -channel B -separate "; $OUT="SGglassHSL.jpg"; exec ("/usr/bin/convert $IN $COLORMAP $OUT"); ?> | ORIGINAL |
LIGHT GRAY |