PHP code example of machinateur / imagickompare

1. Go to this page and download the library: Download machinateur/imagickompare library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

machinateur / imagickompare example snippets




mply compare two files (pdf, png, etc.)
$diffPercentage = \compare_with_imagick('/path/to/control-file', '/path/to/compare-file');
// or define a resolution
$diffPercentage = \compare_with_imagick('/path/to/control-file', '/path/to/compare-file', [100, 100]);
// and define a fuzziness for diff metrics
$diffPercentage = \compare_with_imagick('/path/to/control-file', '/path/to/compare-file', fuzziness: 5);
// the merged file can be saved as well, when passing an open file handle
$diffPercentage = \compare_with_imagick('/path/to/control-file', '/path/to/compare-file', fh: $fh = \fopen('php://temp'));