Functions page: 21

Shear image
Slides one edge of an image along the X or Y axis, creating a parallelogram.
Shear image example

bool shearImage ( mixed $background , float $x_shear , float $y_shear )

<?php $im = new Imagick($input);
$im->shearImage( new ImagickPixel'none' ), 10);
$im->writeImage('shearImage.png'); 
$im->destroy(); ?>


An X direction shear slides an edge along the X axis, while a Y direction shear slides an edge along the Y axis. The amount of the shear is controlled by a shear angle. For X direction shears, x_shear is measured relative to the Y axis, and similarly, for Y direction shears y_shear is measured relative to the X axis. Empty triangles left over from shearing the image are filled with the background color.
sigmoidalContrastImage
Adjusts the contrast of an image with a non-linear sigmoidal contrast algorithm.
sigmoidalContrastImage example

bool sigmoidalContrastImage ( bool $sharpen , float $alpha , float $beta [, int $channel = Imagick::CHANNEL_ALL ] )

<?php 
$im 
= new Imagick($input);
$im->sigmoidalContrastImage0.81);
$im->writeImage('sigmoidalContrastImage.jpg'); 
$im->destroy();
 
?>


Increase the contrast of the image using a sigmoidal transfer function without saturating highlights or shadows. Contrast indicates how much to increase the contrast (0 is none; 3 is typical; 20 is pushing it); mid-point indicates where midtones fall in the resultant image (0 is white; 50 is middle-gray; 100 is black). Set sharpen to TRUE to increase the image contrast otherwise the contrast is reduced.
Sketch image
Simulates a pencil sketch.
Sketch image example

bool sketchImage ( float $radius , float $sigma , float $angle )

<?php 
$im 
= new Imagick($input);
$im->sketchImage10045 );
$im->writeImage('sketchImage.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::sketchImage() selects a suitable radius for you. Angle gives the angle of the blurring motion.
solarizeImage
Applies a special effect to the image, similar to the effect achieved in a photo darkroom by selectively exposing areas of photo sensitive paper to light.
solarizeImage example

bool solarizeImage ( int $threshold )

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


Threshold ranges from 0 to QuantumRange and is a measure of the extent of the solarization.
Sparse color image
Interpolates colors
Untested - documentation seems wrong for the array.


public bool sparseColorImage ( int $SPARSE_METHOD , array $arguments [, int $channel = Imagick::CHANNEL_DEFAULT ] )

<?php /*
$new->sparseColorImage( Imagick::SPARSECOLORMETHOD_BARYCENTRIC, array( 0, 0, black, 0, 20, white ) );
*/ 
?>


Given the arguments array containing numeric values this method interpolates the colors found at those coordinates across the whole image using sparse_method.
Splice image
Splices a solid color into the image
Splice image example

bool spliceImage ( int $width , int $height , int $x , int $y )

<?php 
$im 
= new Imagick($input);
$im->setImageBackgroundColor('#fad888');
$im->spliceImage202010075 );
$im->writeImage('spliceImage.jpg'); 
$im->destroy();
 
?>
Spread image
Special effects method that randomly displaces each pixel in a block defined by the radius parameter.
Spread image example

bool spreadImage ( float $radius )

<?php 
$im 
= new Imagick($input);
$im->spreadImage10 );
$im->writeImage('spreadImage.jpg'); 
$im->destroy();
 
?>
Stegano image
Hides a digital watermark within the image.
None



Recover the hidden watermark later to prove that the authenticity of an image. Offset defines the start position within the image to hide the watermark.
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)))).