image - Use Imagic methods in ImagicDraw in PHP

238

I am usingImagick library for draw image over a image. I need to draw a box over an image, for this print image I am usingImagick, and for draw a image I am usingImagickDraw.

Printing a image withImagick is working fine. And alsoImagickDraw also working fine.

When I useedgeImage method in imagick will make the image as color inverted. Can I useedgeImage method inImagickDraw?

Here is my code:

<?php
$draw = new \ImagickDraw();
$draw->setFillOpacity(0.4);
$draw->setStrokeOpacity(1);
$draw->setStrokeColor("rgba(62,46,45,0.9)");
$draw->setFillColor("rgba(62,46,35,0.9)");
$draw->setStrokeWidth(-2);
$draw->setFontSize(0);
$brightness = "-20";
$contrast = "-20";
$channel = "green";
$draw->pathStart();
$draw->pathMoveToAbsolute (10,0);
$draw->rectangle(0, 0, 170, 300);
$draw->pathFinish();

$imagick = new \Imagick();
$imagick->readImage('images/men2.png');
$imagick->setImageFormat("png32");
$imagick->edgeImage(5);
$imagick->drawImage($draw);
header("Content-Type: image/png");

echo $imagick->getImageBlob();

?>

People are also looking for solutions to the problem: javascript - Saving php data from mysql_fetch_array as script variables

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.