Imagick::compareImageLayers

Returns the maximum bounding region between images

&reftitle.description; public `Imagick` `Imagick::compareImageLayers` `int` `method`

Compares each image with the next in a sequence and returns the maximum bounding region of any pixel differences it discovers. &imagick.method.available.0x629;

&reftitle.parameters;

`method`

- One of the layer method constants.

&reftitle.returnvalues;

&imagick.return.success;

&reftitle.errors;

&imagick.imagick.throws;

&reftitle.examples;

### Using `Imagick::compareImageLayers`

Comparing image layers

    <?php
    /* create new imagick object */
    $im = new Imagick("test.gif");

    /* optimize the image layers */
    $result = $im->compareImageLayers(imagick::LAYERMETHOD_COALESCE);

    /* work on the $result */
    ?>

&reftitle.seealso;

- `Imagick::optimizeImageLayers`
- `Imagick::writeImages`
- `Imagick::writeImage`