« Imagick::compareImageLayers
Imagick::compositeImage »

Imagick::compareImages

(PECL imagick 2, PECL imagick 3)

Imagick::compareImages — ある画像を再構築された画像と比較する

説明

public function Imagick::compareImages(Imagick $compare, int $metric): array

再構築された画像と画像の差異を含む配列を返します。

パラメータ

compare

比較したい画像。

metric

メトリック定数を指定します。この メトリック定数 の一覧を参照ください。

戻り値

再構築された画像と画像の差異を含む配列を返します。

エラー / 例外

エラー時に ImagickException をスローします。

例

例1 Imagick::compareImages() の使用法

画像を比較し、再構築された画像を表示します。

<?php

$image1 = new imagick("image1.png");
$image2 = new imagick("image2.png");

$result = $image1->compareImages($image2, Imagick::METRIC_MEANSQUAREERROR);
$result[0]->setImageFormat("png");

header("Content-Type: image/png");
echo $result[0];

?>

関連キーワード:
画像   Imagick   image   構築   compareImages   imagick   compare   metric   差異   メトリック   定数   compareImageLayers   compositeImage   ImagickException   setImageFormat   header   Content   Type
関連する関数・ページ:
imagick.getimagedistortion   imagick.newimage   imagick.addimage   imagick.tostring   imagick.removeimage   imagick.getimagechanneldistortion