This tutorial covers croping using PHP with Image Magick from the command line. For more information on PHP variables see Lesson I on making backgrounds. | |||||||||||
| |||||||||||
ORIGINAL IMAGE 214x156 | |||||||||||
<? $IN="cards.jpg"; $CROP="-crop 214x156-107-0"; $OUT="JackCard.jpg"; exec ("/usr/bin/convert $IN $CROP +repage $OUT"); ?> | |||||||||||
<? $IN="cards.jpg"; $CROP="-crop 214x156+107-0"; $OUT="QueenCard.jpg"; exec ("/usr/bin/convert $IN $CROP +repage $OUT"); ?> | |||||||||||
<? $IN="cards.jpg"; $CROP="-crop 214x156-0-125"; $OUT="TopCard.jpg"; exec ("/usr/bin/convert $IN $CROP +repage $OUT"); ?> | |||||||||||
<? $IN="cards.jpg"; $CROP="-crop 214x156-0+125"; $OUT="BottomCard.jpg"; exec ("/usr/bin/convert $IN $CROP +repage $OUT"); ?> | |||||||||||
<? $IN="cards.jpg"; $CROP="-crop 214x156-120-125"; $OUT="JackTop.jpg"; exec ("/usr/bin/convert $IN $CROP +repage $OUT"); ?> | |||||||||||
<? $IN="cards.jpg"; $CROP="-crop 214x156+120-125"; $OUT="QueenTop.jpg"; exec ("/usr/bin/convert $IN $CROP +repage $OUT"); ?> | |||||||||||
<? $IN="cards.jpg"; $GRAVITY="-gravity center"; $CROP="-crop 50x50%+0+0"; $OUT="CenterCard.jpg"; exec ("/usr/bin/convert $IN $GRAVITY $CROP +repage $OUT"); ?> | |||||||||||
<? $IN="cards.jpg"; $GRAVITY="-gravity north"; $CROP="-crop 80x50%+0+0"; $OUT="NorthCard.jpg"; exec ("/usr/bin/convert $IN $GRAVITY $CROP +repage $OUT"); ?> | |||||||||||
<? $IN="cards.jpg"; $GRAVITY="-gravity north"; $CROP="-crop 80x50+0+0"; $OUT="NorthPixel.jpg"; exec ("/usr/bin/convert $IN $GRAVITY $CROP +repage $OUT"); ?> |