Im Working on Creating Text Image with gradient colors with Strokewidth Applied to the Text(i.e.as per #Image Model), but able to success it for certain level, but when apply the Strokewidth & StrokeColor it takes only The Color of gradient.png(gradient colored imaged) i have created it with imagick instance,& I'm merging the gradient.png & canvas.png(that contains the imagickDraw for Text "CAPTURE"), (i.e. My_output_Image). But the Final output i need was like #image Model & also i need the options the increase the quality of image.
#Image Model:
#My_output_Image:
This is my code :
------------------
Code: Select all
<?php
/* Create and save the gradiant */
$Imagick = new \Imagick();
$Imagick->newPseudoImage( 500, 100, "gradient:#83D6FC-#0088FF" );
$Imagick->setImageFormat( 'png' );
$Imagick->writeImage("gradiant.png");
/* Create and save the canvas */
$im = new \Imagick();
$im->newPseudoImage( 500, 100, "null:" );
$im->setImageFormat( 'png' );
$im->writeImage("canvas.png");
/* Add the text to the canvas ( Make the mask )*/
$im = new \Imagick( "canvas.png" );
$draw = new ImagickDraw();
$draw->setFont('Capture_it.ttf');
$draw->setFontSize( 90 );
$draw->setStrokeColor('#000000');
$draw->setStrokeWidth(2);
$draw->setFillColor( new \ImagickPixel("white"));
// Set gravity to the center.
$draw->setGravity( Imagick::GRAVITY_CENTER );
// Write the text on the image
$im->annotateImage( $draw, 0, 0, 0, "CAPTURE" );
/* Final image */
$canvas = new \Imagick( "gradiant.png" );
$canvas->compositeImage($im, \Imagick::COMPOSITE_COPYOPACITY, 0, 0.75);
$canvas->compositeImage( $im, imagick::COMPOSITE_DSTIN, 0, 0 );
$canvas->setImageFormat( 'png' );
$canvas->writeImage("final.png");
header("Content-Type: image/png");
echo $canvas;
?>
Any Help Appreciated. Plz Correct Me If i have Made Making any Mistakes...