Functions page: 22

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.
Valid
Checks if the current item is valid.
None

Vignette image
Softens the edges of the image in vignette style.
Vignette image example

bool vignetteImage ( float $blackPoint , float $whitePoint, int $x , int $y )

<?php 
$im 
= new Imagick($input);
$im->setimagebackgroundcolor('black');
$im->vignetteImage502555);
$im->writeImage"vignetteImage.jpg" );
$im->destroy();
 
?>
Wave image
Applies a wave filter to the image.
Wave image example

bool waveImage ( float $amplitude , float $length )

<?php 
$im 
= new Imagick($input);
$im->setimagebackgroundcolor('none');
$im->waveImage2050 );
$im->writeImage'waveImage.png' );
$im->destroy();
 
?>
White threshold image
Force all pixels above the threshold into white.
White threshold image example

bool whiteThresholdImage ( mixed $threshold )

<?php 
$im 
= new Imagick($input);
$im->whiteThresholdImage'#dee4b8' );
$im->writeImage'whiteThresholdImage.jpg' );
$im->destroy();
 
?>


Is like ThresholdImage() but force all pixels above the threshold into white while leaving all pixels below the threshold unchanged.
Write image file
Writes an image to a filehandle
None



The handle must be opened with for example fopen.
Write images
Writes an image or image sequence.
Write images example

bool writeImages ( string $filename , bool $adjoin )

<?php 
// All jpg images from a directory
// $images = new Imagick(glob("images/{*.jpg,*.JPG}", GLOB_BRACE));
// Array of images
$images = array('blackThresholdImage.jpg''blurImage.jpg''charcoalImage.jpg');
$images = new Imagick($images);

foreach(
$images as $image) {

$image->thumbnailImage(100,0);
}
// Individual images created in the format output-0.jpg
// $images->writeImages('output.jpg', false); 
$images->writeImages('writeImages.gif'true); 
 
?>
Write images file
Writes all image frames into an open filehandle.
None



This method can be used to write animated gifs or other multiframe images into open filehandle.
writeImage
Writes an image to the specified filename.
writeImage example

bool writeImage ([ string $filename ] )

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


If the filename parameter is NULL, the image is written to the filename set by ReadImage() or SetImageFilename().