Change language

PHP Imagick function mergeImageLayers ()

Syntax:
Imagick Imagick::mergeImageLayers (int $layer_method)
Parameters:This function takes one parameter, $layer_method,which contains an integer value corresponding to one of LAYERMETHOD constants . You can also pass constants directly like mergeImageLayers (Imagick::LAYERMETHOD_COMPAREANY).The list of LAYERMETHOD constants is below:
  • imagick::LAYERMETHOD_UNDEFINED (0)
  • imagick::LAYERMETHOD_COALESCE (1)
  • imagick::LAYERMETHOD_COMPAREANY (2)
  • imagick::LAYERMETHOD_COMPARECLEAR (3)
  • imagick::LAYERMETHOD_COMPAREOVERLAY (4)
  • imagick::LAYERMETHOD_DISPOSE (5)
  • imagick::LAYERMETHOD_OPTIMIZE (6)
  • imagick::LAYERMETHOD_OPTIMIZEPLUS (7 )
  • imagick::LAYERMETHOD_OPTIMIZEIMAGE (8)
  • imagick::LAYERMETHOD_OPTIMIZETRANS (9)
  • imagick::LAYERMETHOD_REMOVEDUPS (10)
  • imagick::LAYERMETHOD_REMOVEZERO (11)
  • imagick::LAYERMETHOD_COMPOSITE (12)
  • imagick::LAYERMETHOD_MERGE (13)
  • imagick::LAYERMETHOD_FLATTEN (14)
  • imagick::LAYERMETHOD_MOSAIC (15)
Return value:this function returns an object Imagick containing the new image.Exceptions:This function throws an ImagickException on error.The following programs illustrate the Imagick::mergeImageLayers() function in PHP:Program 1:  
// Create a new Imagick object $imagick = new Imagick ( https://media.engineerforengineer.org/wp-content/uploads/20190918234528/colorize1.png );  
// Add another image to the same object $imagick -> addImage ( new Imagick ( https://media.engineerforengineer.org/wp-content/uploads/20191126190119/engineerforengineer-copy.png ));  
// Set opacity $imagick -> setImageOpacity (0.5);  
// Merge layers $result = $imagick -> mergeImageLayers (Imagick::LAYERMETHOD_FLATTEN);  
// Show image header ( "Content-Type: image / png" ); echo $result -> getImageBlob(); ?>
Output: Program 2:  
// Create new Imagick object $imagick = new Imagick ( https://media.engineerforengineer.org/wp-content/uploads/20190918234528/colorize1.png );  
// Add another image to the same object $imagick -> addImage ( new Imagick ( https://media.engineerforengineer.org/wp-content/uploads/20191126191401/engineerforengineerhalf.png ));  
// Set opacity $imagick -> setImageOpacity (0.7);  
// Merge layers $result = $imagick -> mergeImageLayers (11);  
// Show image header ( "Content-Type: image / png" ); echo $result -> getImageBlob(); ?>
Output: Link: https://www.php.net/manual/en/imagick.mergeimagelayers.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