PHP | ImagickKernel scale() Function Last Updated : 14 Jan, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The ImagickKernel::scale() function is an inbuilt function in PHP which is used to scale the given kernel list by the given amount. Syntax: void ImagickKernel::scale( float $scale, int $normalizeFlag ) Parameters: This function accept two parameters as mentioned above and described below: $scale: It specifies the amount of scale. $normalizeFlag: It specifies the type of scale. Return Value: This function does not return any value. Below programs illustrate the ImagickKernel::scale() function in PHP: Program 1: php <?php // Create a new imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); $matrix = [ [0, 0, 1], [0, 2, 1], [1, 1, 1], ]; // Create a kernel from built-in matrix $kernel = ImagickKernel::fromMatrix($matrix); echo 'Before scaling:<br>'; print("<pre>".print_r($kernel->getMatrix(), true)."</pre>"); // Scale the kernel $kernel->scale(5, Imagick::NORMALIZE_KERNEL_VALUE); echo 'After scaling:<br>'; print("<pre>".print_r($kernel->getMatrix(), true)."</pre>"); ?> Output: Before scaling: Array ( [0] => Array ( [0] => 0 [1] => 0 [2] => 1 ) [1] => Array ( [0] => 0 [1] => 2 [2] => 1 ) [2] => Array ( [0] => 1 [1] => 1 [2] => 1 ) ) After scaling: Array ( [0] => Array ( [0] => 0 [1] => 0 [2] => 0.71428571428571 ) [1] => Array ( [0] => 0 [1] => 1.4285714285714 [2] => 0.71428571428571 ) [2] => Array ( [0] => 0.71428571428571 [1] => 0.71428571428571 [2] => 0.71428571428571 ) ) Program 2: php <?php // Create a new imagick object $imagick = new Imagick( 'https://media.geeksforgeeks.org/wp-content/uploads/geeksforgeeks-13.png'); $matrix = [ [1, 2, -3], [4, 5, 6], [7, 8, 9] ]; // Create a kernel from matrix $kernel = ImagickKernel::fromMatrix($matrix); // Scale the kernel $kernel->scale(4, Imagick::NORMALIZE_KERNEL_VALUE); // Add the filter $imagick->filter($kernel); // Show the output $imagick->setImageFormat('png'); header("Content-Type: image/png"); echo $imagick->getImageBlob(); ?> Output: Reference: https://www.php.net/manual/en/imagickkernel.scale.php Comment More infoAdvertise with us Next Article PHP | Gmagick scaleimage() Function G gurrrung Follow Improve Article Tags : Web Technologies PHP PHP-function PHP-Imagick Similar Reads PHP | ImagickDraw scale() Function The ImagickDraw::scale() function is an inbuilt function in PHP which is used to adjust the scaling factor to apply in the horizontal and vertical directions to the current coordinate space. Syntax:Â bool ImagickDraw::scale( $x, $y ) Parameters: This function accepts two parameter as mentioned above 2 min read PHP | Imagick scaleImage() Function The Imagick::scaleImage() function is an inbuilt function in PHP which is used to scale the size of an image to the given dimensions. Syntax: bool Imagick::scaleImage( int $cols, int $rows, bool $bestfit = false, bool $legacy = false ) Parameters: This function accepts four parameters as mentioned a 2 min read PHP | Imagick setPage() Function The Imagick::setPage() function is an inbuilt function in PHP which is used to set the page geometry of the Imagick object. Syntax: bool Imagick::setPage( int $width, int $height, int $x, int $y ) Parameters:This function accepts four parameters as mentioned above and described below: $width: It spe 2 min read PHP | Gmagick scaleimage() Function The Gmagick::scaleimage() function is an inbuilt function in PHP which is used to scale the size of an image to the given dimensions.Syntax:Â Â Gmagick Gmagick::scaleimage( $width, $height, $fit = FALSE ) Parameters: This function accepts three parameters as mentioned above and described below:Â Â $wi 1 min read PHP | Imagick sampleImage() Function The Imagick::sampleImage() function is an inbuilt function in PHP which is used to scale an image to the desired dimensions with pixel sampling.This method does not introduce any additional color into the scaled image like other resizing methods. Syntax: bool Imagick::sampleImage( int $rows, int $co 1 min read PHP | Imagick sketchImage() Function The Imagick::sketchImage() function is an inbuilt function in PHP which is used to simulates a pencil sketch. This function convolves the image with a Gaussian operator of the given radius and standard deviation. Syntax: bool Imagick::sketchImage( $radius, $sigma, $angle ) Parameters: This function 1 min read Like