Change language

PHP Imagick colorMatrixImage () function

Syntax:
bool Imagick::colorMatrixImage (array $color_matrix = Imagick::CHANNEL_DEFAULT)
Parameters:This function takes one parameter, $color_matrix,which is used to store a 5x5 matrix for RGBA with rows denoting red, green, blue, alpha output, and columns - red, green, blue, alpha input, while the last row and columns to adjust brightness. In a 6x6 matrix for CMYKA, where rows represent cyan, magenta, yellow, tonal or black, alpha output, and columns - cyan, magenta, yellow, tonal or black, alpha input and alpha to adjust brightness similarly in RGBA, CMYKA also has last row and columns to adjust brightness.Return value: this function returns True on success and returns False on error.The following program illustrates the Imagick::colorMatrixImage() function in PHP:Program:  
 
// 6x6 color matrix for CMYKA $colorMatrix = [ 1.5 , 0.0, 0.0, 0.0, 0.0, -0.157, 0.0, 0.0, 0.5, 0.0, 0 .0, -0.157, 0.0, 0.0, 0.0, 0.0, 0.5, -0.157 , 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 0.5, 0.0, 1.0 ];  
// Create Imagick object $imagick = new Imagick ( https://cdncontribute.engineerforengineer.org/wp-content/uploads/engineerforengineer-13.png ) ;  
// Set the opacity of the image $imagick -> evaluateImage ( Imagick::EVALUATE_MULTIPLY, 0.6, Imagick::CHANNEL_ALPHA );  
// Create a new Imagick object $background = new Imagick();  
// Create a new pseudo image with a hexagon pattern $background -> newPseudoImage ( $imagick -> getImageWidth(), $imagick -> getImageHeight(), "pattern: hexagons");  
// Set image format $background -> setImageFormat ( ’png’ ); $imagick -> setImageFormat ( ’png’ );  
// Use the Imagick function::colorMatrixImage() $imagick -> colorMatrixImage ( $colorMatrix );  
// Use the Imagick function::composite image() $background -> compositeImage ( $imagick , Imagick::COMPOSITE_SRCATOP, 0, 0 ); header ( " Content-Type: image / png " );  
// Display the output image echo $background -> getImageBlob();  
?>
Output: Link: https://www.php.net/manual/en/imagick.colormatriximage.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method