PHP | Gmagick cyclecolormapimage() Function
The Gmagick::cyclecolormapimage() function is an inbuilt function in PHP which is used to displace an image colormap by a given number of positions. If you cycle the colormap a number of times you can produce a psychedelic effect.
Syntax:
Gmagick Gmagick::cyclecolormapimage( int $displace )
Parameters: This function accepts a single parameter $displace which holds the displacement.
Return Value: This function returns Gmagick object on success.
Exceptions: This function throws GmagickException on error.
Below given programs illustrate the Gmagick::cyclecolormapimage() function in PHP:
Used Image:
Program 1:
php
<?php
$gmagick = new Gmagick( 'geeksforgeeks.png' );
$gmagick ->cyclecolormapimage(2);
header( 'Content-type: image/png' );
echo $gmagick ;
?>
|
Output:
Program 2:
php
<?php
$gmagick = new Gmagick( 'geeksforgeeks.png' );
$draw = new GmagickDraw();
$draw ->setFillColor( 'white' );
$draw ->rectangle(0, 0, 800, 400);
$draw ->setFillColor( 'red' );
$draw ->setfontsize(50);
$draw ->annotate(30, 100, 'GeeksforGeeks' );
$gmagick ->drawImage( $draw );
$gmagick ->cyclecolormapimage(1);
header("Content-Type: image/png");
echo $gmagick ->getImageBlob();
?>
|
Output:
Reference: https://www.php.net/manual/en/gmagick.cyclecolormapimage.php
Last Updated :
21 Jun, 2022
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...