Change language

PHP ImagickvaluImage () function

Syntax:
bool Imagick::evaluateImage ($evaluation_op, $constant, $channel = Imagick::CHANNEL_DEFAULT)
Parameters:This function takes three parameters as above and described below:
  • $valuation_op:contains a valuation statement like like addition, subtraction, division, mod, etc.
  • $constant:contains the value of the operator with a score.
  • $channel: provides any channel constant suitable for the desired channel mode.
Return Value:Returns a boolean value true if the function succeeds, otherwise returns false .Below are programs illustrating the Imagick::valuImage() function in PHP:Program 1:  
// Create an Imagick object $imagick = new Imagick ( https://media.engineerforengineer.org/wp-content/uploads/engineerforengineer-9.png );  
// Declare and initialize the variable value $evaluation_op = Imagick::EVALUATE_DIVIDE; $constant = 3; $channel = Imagick::CHANNEL_ALPHA;  
// Use the valuImage function $imagick -> evaluateImage ( $evaluation_op , $constant , $channel ); header ( " Content-Type: image / jpg " );  
// Display the output image echo $imagick -> getImageBlob();  
?>
Output: Program 2:  
// Create new Imagick object $image = new Imagick (__ DIR__. ’sample.png’ );  
// Set the alpha channel to opaque to make it easier to work with opaque $image -> setImageAlphaChannel (Imagick::ALPHACHANNEL_OPAQUE);  
// Set parameter values ​​ $evaluation_op = Imagick::EVALUATE_DIVIDE; $constant = 3; $channel = Imagick::CHANNEL_ALPHA;  
// Call the function with parameters $image -> evaluateImage ( $evaluation_op , $constant , $channel ); header ( ’ Content-type: image / jpeg’ );  
// Write a new image to the specified directory $image -> writeImage (__ DIR__. ’sample_with_33perc_opacity.png ’ );  
?>
Output: Program 3:  
// Definition functions function Evaluate_Image ( $image , $evaluation_op , $constant , $channel ) { $image -> evaluateImage ( $eva luation_op , $constant , $channel ); return $image ; }  
// Set parameter values ​​ $final_image = Evaluate_Image ( new Imagick (__ DIR__. ’sample.png’ ), Imagick::EVALUATE_MEAN, 3, Imagick::CHANNEL_BLUE ); header ( ’ Content-type: image / jpeg’ );  
// Display the output image echo $final_image -> getImageBlob();  
?>
Output: Link: https://www.php.net/manual/en/imagick.evaluateimage.php
Please comment if you find something wrong or want to add more information. Happy coding!

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