DJ Mike's Tutorials: PHP

Imagick Functions

^

Imagick::newImage

Description:
bool Imagick::newImage ( int $width , int $height , mixed $background [, string $format ] )

Creates a new image and associates ImagickPixel value or string as background color.
Parameters:
width
Width of the new image
height
Height of the new image
background
String or ImagickPixel object representing the background color.
format
Image format. This parameter was added in Imagick version 2.0.1.
Return Values
Returns TRUE on success.
Errors/Exceptions
Throws ImagickException on error.

Example


<?
$text 
"DJ Mike";
$font "Bookman-DemiItalic";
$pointsize 100;
$depth 4;

# make a transparent pallete
$pallete = new Imagick;
$pallete->newimage(450,105"transparent");
# set pallet format to gif
$pallete->setimageformat("gif");

# make a draw object with settings
$draw = new imagickdraw();
$draw->setgravity(imagick::GRAVITY_CENTER);
$draw->setfont("$font");
$draw->setfontsize($pointsize);

# set font color white
$draw->setfillcolor("#ffffff");
# offset annotate
$pallete->annotateImage $draw,$depth ,-$depth-30$text );
$pallete->annotateImage $draw,-$depth ,-$depth-30$text );

# set font color black
$draw->setfillcolor("#000000");
# offset annotate
$pallete->annotateImage $draw,-$depth ,$depth-20$text );
$pallete->annotateImage $draw,$depth ,$depth-30$text );

# set font color blue
$draw->setfillcolor("#0000ff");
# center annotate on top of offset annotates
$pallete->annotateImage $draw,,00$text );

# blur
$pallete->gaussianBlurImage21.5 ); 

# output to browser
$pallete->setImageFormat("gif");
header"Content-Type: image/gif" );
echo 
$pallete;
?>


^


Created by DJ Mike from Santa Barbara

DJ Mike


Dance Away Santa Barbara's Home Page
<a href="http://www.statcounter.com/" target="_blank"> <img src="http://c5.statcounter.com/counter.php?sc_project=1321035&java=0&security=da2193dc" alt="counter free hit invisible" border="0" /></a>