Rubblewebs

THESE CODES ARE PROVIDED FOR AN EXAMPLE OF HOW TO USE IMAGEMAGICK WITH PHP. CARE SHOULD BE TAKEN WHEN ACCEPTING USER INPUT.

I TAKE NO RESPONSABILTY FOR ANY PROBLEMS THAT MAY OCCURE WHEN USING ANY OF THIS CODE.

IT IS UP TO YOU TO SECURE THE CODE AND VALIDATE USER INPUT.

Imagick Functions page: 18

Set font

Sets object's font property.

Set font example
$width = '200';
$height = '100';
$text = 'Rubblewebs';
$im = new Imagick();
$draw = new ImagickDraw();
$draw->setFont('arial.ttf');
$draw->setFontSize( 28 );
$fillcolor = new ImagickPixel( "white" );
$draw->setFillColor( $fillcolor );
$draw->setGravity( Imagick::GRAVITY_CENTER );
$bgcolor = new ImagickPixel( 'Black' );
$im->newImage($width, $height, $bgcolor );
$im->annotateImage($draw, 0, 0, 0, $text);
$im->writeImage( 'setFont.jpg' );
$im->destroy();

( This method can be used for example to set font for caption: pseudo-format. The font needs to be configured in ImageMagick confiration or a file by the name of font must exist. This method should not be confused with ImagickDraw::setFont() which sets the font for a specific ImagickDraw object. )

Set format

Sets the format of the Imagick object.

Set gravity

Sets the global gravity property for the Imagick object.

Set gravity example
$width = '200';
$height = '100';
$text = 'Rubblewebs';
$im = new Imagick();
$draw = new ImagickDraw();
$draw->setFont('arial.ttf');
$draw->setFontSize( 28 );
$fillcolor = new ImagickPixel( "white" );
$draw->setFillColor( $fillcolor );
$draw->setGravity( Imagick::GRAVITY_CENTER );
$bgcolor = new ImagickPixel( 'Black' );
$im->newImage($width, $height, $bgcolor );
$im->annotateImage($draw, 0, 0, 0, $text);
$im->writeImage( 'setGravity.jpg' );
$im->destroy();

Set image

Replaces the current image sequence with the image from replace object.

Set image alpha channel

Activate or deactivate image alpha channel.

Set image alpha channel example
$im = new Imagick('rotateImage.png');
$im->setImageAlphaChannel( Imagick::ALPHACHANNEL_OPAQUE);
$im->writeImage('setImageAlphaChannel.png'); 
$im->destroy();

( The mode is one of the ALPHACHANNEL_* constants. )

Set image artifact

Associates an artifact with the image.


( The difference between image properties and image artifacts is that properties are public and artifacts are private. )

Set image background color

Sets the image background color.

Set image background color example
$im = new Imagick($input);
$shadow = $im->clone(); 
$shadow->setImageBackgroundColor( new ImagickPixel( 'blue' ) ); 
$shadow->shadowImage( 80, 3, 5, 5 ); 
$shadow->compositeImage( $im, Imagick::COMPOSITE_OVER, 0, 0 ); 
$shadow->writeImage( "setImageBackgroundColor.png" );
$shadow->destroy();

Set image bias

Sets the image bias for any method that convolves an image (e.g. ConvolveImage()).

Set image blue primary

Sets the image chromaticity blue primary point.

Set image border color

Sets the image border color.

Set image channel depth

Sets the depth of a particular image channel.

Set image clip mask

Sets image clip mask from another Imagick object.

Set image colormap color

Sets the color of the specified colormap index.

Set image colorspace

Sets the image colorspace.