예제 #1
0
    return;
}
$climate->arguments->parse($argv);
$percent = $climate->arguments->get('percent');
if (!empty($percent) && !is_numeric($percent)) {
    $climate->error('Please enter numeric format.');
    $climate->usage();
    return;
} else {
    $percent /= 100;
}
$json = json_decode(file_get_contents('./paths.json'));
mkdir('./images/output');
$climate->Green("Comparing level is {$percent}%\n");
$climate->Green("Preparing to comparing...\n");
$progress = $climate->progress()->total(count($json->path));
$files = array();
$files_error = array();
foreach ($json->path as $path_key => $path) {
    $file1 = "./images/{$tag_one}/{$path_key}.png";
    $file2 = "./images/{$tag_two}/{$path_key}.png";
    chmod("./images/{$tag_one}", 0777);
    chmod("./images/{$tag_two}", 0777);
    $progress->current($path_key + 1, "Comparing between {$file1} and {$file2}");
    if (file_exists($file1) && file_exists($file2)) {
        $image1 = new imagick($file1);
        $image2 = new imagick($file2);
        $d1 = $image1->getImageGeometry();
        $w1 = $d1['width'];
        $h1 = $d1['height'];
        $d2 = $image2->getImageGeometry();