Imagick functions page 23

Stereo image
Composites two images
None



Composites two images and produces a single image that is the composite of a left and right image of a stereo pair.
Strip image
Strips an image of all profiles and comments.
Strip image example

bool stripImage ( void )

<?php 
$im 
= new Imagick($input);
$im->stripImage();
$im->swirlImage100 );
$im->writeImage('stripImage.jpg'); 
$im->destroy();
 
?>
Swirl image
Swirls the pixels about the center of the image.
Swirl image example

bool swirlImage ( float $degrees )

<?php 
$im 
= new Imagick($input);
$im->swirlImage50 );
$im->writeImage('swirlImage.jpg'); 
$im->destroy();
 
?>


Where degrees indicates the sweep of the arc through which each pixel is moved. You get a more dramatic effect as the degrees move from 1 to 360.
Texture image
Repeatedly tiles the texture image across and down the image canvas.
Texture image example

bool textureImage ( Imagick $texture_wand )

<?php 
$im 
= new Imagick($input);
$texture = new Imagick('bricks.png');
$im $im->textureImage$texture );
$im->writeImage'textureImage.png');
$im->destroy();
 
?>


The texture part is working but the transparency of the texture is being lost.
Threshold image
Changes the value of individual pixels based on the intensity of each pixel compared to threshold.
Threshold image example

bool thresholdImage ( float $threshold [, int $channel = Imagick::CHANNEL_ALL ] )

<?php 
$im 
= new Imagick($input);
$im->thresholdImage5000 );
$im->writeImage('thresholdImage.jpg'); 
$im->destroy();
 
?>


The result is a high-contrast, two color image.
Thumbnail image
Changes the size of an image
Thumbnail image example

bool thumbnailImage ( int $columns , int $rows [, bool $bestfit = false [, bool $fill = false ]] )

<?php 
$im 
= new Imagick$input );
$im->thumbnailImage150150TRUE );
$im->writeImage"thumbnailImage.jpg" );
$im->destroy();
 
?>


Changes the size of an image to the given dimensions and removes any associated profiles. The goal is to produce small low cost thumbnail images suited for display on the Web. If TRUE is given as a third parameter then columns and rows parameters are used as maximums for each side. Both sides will be scaled down until the match or are smaller than the parameter given for the side.
Tint image
Applies a color vector to each pixel in the image.
Tint image example

bool tintImage ( mixed $tint , mixed $opacity )

<?php 
$im 
= new Imagick($input);
$im->tintImageblue80 );
$im->writeImage"tintImage.jpg" );
$im->destroy();
 
?>


The length of the vector is 0 for black and white and at its maximum for the midtones. The vector weighing function is f(x)=(1-(4.0*((x-0.5)*(x-0.5)))).
Transform image
A convenience method for setting crop size and the image geometry from strings.
Transform image example

Imagick transformImage ( string $crop , string $geometry )

<?php 
$im 
= new Imagick$input );
$image $im->transformImage'150x150''100x100' );
$image->writeImage"transformImage.jpg" );
$image->destroy();
 
?>
Transparent paint image
Paints pixels matching the target color transparent.
Transparent paint image example

bool transparentPaintImage ( mixed $target , float $alpha , float $fuzz , bool $invert )

<?php 
$im 
= new Imagick($input);
$im->transparentPaintImage'#850d17'020FALSE );
$im->writeImage('transparentPaintImage.jpg'); 
$im->destroy();
 
?>


NOT WORKING AS EXPECTED
Transpose image
Creates a vertical mirror image by reflecting the pixels around the central x-axis while rotating them 90-degrees.
Transpose image example

bool transposeImage ( void )

<?php 
$im 
= new Imagick$input );
$im->transposeImage();
$im->writeImage"transposeImage.jpg" );
$im->destroy();
 
?>
Transverse image
Creates a horizontal mirror image by reflecting the pixels around the central y-axis while rotating them 270-degrees.
Transverse image example

bool transverseImage ( void )

<?php 
$im 
= new Imagick$input );
$im->transverseImage();
$im->writeImage"transverseImage.jpg" );
$im->destroy();
 
?>
Trim image
Remove edges that are the background color from the image.
Trim image example

bool trimImage ( float $fuzz )

<?php 
$im 
= new Imagick'borderImage.jpg' );
$im->trimImage);
$im->writeImage"trimImage.jpg" );
$im->destroy();
 
?>


Not working as expected - only trims the bottom edge and then not fully.
Unique image colors
Discards all but one of any pixel color.
Unique image colors example

bool uniqueImageColors ( void )

<?php 
$im 
= new Imagick$input );
$im->uniqueImageColors();
$im->resizeImage20050imagick::FILTER_LANCZOSFALSE );
$im->writeImage"uniqueImageColors.jpg" );
$im->destroy();
 
?>


Resized to fit on the page.
Unsharp mask image
Sharpens an image.
Unsharp mask image example

bool unsharpMaskImage ( float $radius , float $sigma , float $amount , float $threshold [, int $channel = Imagick::CHANNEL_ALL ] )

<?php 
$im 
= new Imagick$input );
$im->unsharpMaskImage(0.5 0.05);
$im->writeImage"unsharpMaskImage.jpg" );
$im->destroy();
 
?>


We convolve the image with a Gaussian operator of the given radius and standard deviation (sigma). For reasonable results, radius should be larger than sigma. Use a radius of 0 and Imagick::UnsharpMaskImage() selects a suitable radius for you.