<?php
$imagick
=
new
Imagick();
$imagick
->newImage(800, 250,
'white'
);
$draw
=
new
ImagickDraw();
$draw
->annotation(100, 200,
'With pathClose()'
);
$draw
->annotation(500, 200,
'Without pathClose()'
);
$draw
->setStrokeColor(
'green'
);
$draw
->setStrokeWidth(5);
$draw
->pathStart();
$draw
->pathMoveToAbsolute(20, 50);
$draw
->pathMoveToRelative(20, 0);
$draw
->pathLineToRelative(50, 90);
$draw
->pathLineToVerticalRelative(0);
$draw
->pathLineToHorizontalAbsolute(250);
$draw
->pathClose();
$draw
->pathFinish();
$draw
->translate(400, 0);
$draw
->pathStart();
$draw
->pathMoveToAbsolute(20, 50);
$draw
->pathMoveToRelative(20, 0);
$draw
->pathLineToRelative(50, 90);
$draw
->pathLineToVerticalRelative(0);
$draw
->pathLineToHorizontalAbsolute(250);
$draw
->pathFinish();
$imagick
->drawImage(
$draw
);
$imagick
->setImageFormat(
'png'
);
header(
"Content-Type: image/png"
);
echo
$imagick
->getImageBlob();
?>