比较两张图片是否相同
@param Image $image
@return bool
776453
public function compare(Image $image) {
		$hash1 = $this->getHashValue();
		$hash2 = $image->getHashValue();
		if (strlen($hash1) !== strlen($hash2)) {
			return false;
		}
		$count = 0;
		$len = strlen($hash1);
		for ($i = 0; $i < $len; $i++) {
			if ($hash1[$i] !== $hash2[$i]) {
				$count++;
			}
		}
		return $count <= 10;
	}
522046
public function run(Image $image)
    {
        $gamma = $this->getGamma();

        if ($gamma) {
            $image->gamma($gamma);
        }

        return $image;
    }
1373359
public function run(Image $image)
    {
        $width = $this->getWidth();
        $height = $this->getHeight();
        $fit = $this->getFit();
        $dpr = $this->getDpr();

        list($width, $height) = $this->resolveMissingDimensions($image, $width, $height);
        list($width, $height) = $this->applyDpr($width, $height, $dpr);
        list($width, $height) = $this->limitImageSize($width, $height);

        if ((int) $width !== (int) $image->width() or (int) $height !== (int) $image->height()) {
            $image = $this->runResize($image, $fit, (int) $width, (int) $height);
        }

        return $image;
    }
596863
public function run(Image $image)
    {
        if ($border = $this->getBorder($image)) {
            list($width, $color, $method) = $border;

            if ($method === 'overlay') {
                return $this->runOverlay($image, $width, $color);
            }

            if ($method === 'shrink') {
                return $this->runShrink($image, $width, $color);
            }

            if ($method === 'expand') {
                return $this->runExpand($image, $width, $color);
            }
        }

        return $image;
    }
994004
protected function ScaledImage(Image $image, $thumbnail = false)
    {
        $img = false;
        $background = $this->PaddedImageBackground;
        
        if ($thumbnail == true) {
            $resize_type = $this->getThumbResize();
            $width = $this->getThumbWidth();
            $height = $this->getThumbHeight();
        } else {
            $resize_type = $this->getFullResize();
            $width = $this->getFullWidth();
            $height = $this->getFullHeight();
        }

        switch ($resize_type) {
            case 'crop':
                $img = $image->Fill($width,$height);
                break;
            case 'pad':
                $img = $image->Pad($width,$height,$background);
                break;
            case 'ratio':
                $img = $image->Fit($width,$height);
                break;
            case 'width':
                $img = $image->ScaleWidth($width);
                break;
            case 'height':
                $img = $image->ScaleHeight($height);
                break;
        }

        $this->extend("augmentImageResize", $image, $thumbnail, $img);

        return $img;
    }
284169
public function run(Image $image)
    {
        $contrast = $this->getContrast();

        if ($contrast !== null) {
            $image->contrast($contrast);
        }

        return $image;
    }
178731
public function applyToImage(Image $image, $x = 0, $y = 0)
    {
        $polygon = new \ImagickDraw;

        // set background
        $bgcolor = new Color($this->background);
        $polygon->setFillColor($bgcolor->getPixel());

        // set border
        if ($this->hasBorder()) {
            $border_color = new Color($this->border_color);
            $polygon->setStrokeWidth($this->border_width);
            $polygon->setStrokeColor($border_color->getPixel());
        }

        $polygon->polygon($this->points);

        $image->getCore()->drawImage($polygon);

        return true;
    }
962992
public function execute($image)
    {
        $amount = $this->argument(0)->between(0, 100)->value(10);

        return $image->getCore()->unsharpMaskImage(1, 1, $amount / 6.25, 0);
    }
770006
public function isEqual()
    {
        // CHECK IMAGES DIMENSIONS
        if(!$this->isDimensionsEqual())
        {
            return FALSE;
        }

        $compare = $this->image1->compareImages($this->image2, Imagick::METRIC_MEANSQUAREERROR);

        // IMAGE IS EXACTLY THE SAME
        if($compare === TRUE)
        {
            return TRUE;
        }
        // IMAGE IS IN TOLERABLE RANGE
        elseif($compare)
        {
            if($compare[1] < $this->tolerance)
            {
                return TRUE;
            }
        }

        return FALSE;
    }
56971
public static function is_image($image, $format = null, $returnBase64Encode = false)
    {
        // url file content
        if (is_string($image)) {
            if (!static::is_url($image) && !static::is_file($image)) {
                /**
                 * 既不是 url 也不是 file.
                 */
                $content = $image;
                $image = @getimagesizefromstring($image);
            } else {
                $content = file_get_contents($image);
                $image = @getimagesize($image);
            }
        } elseif (self::is_splFileInfo($image)) {
            /*
             * SplFileInfo -> file
             */
            $file = $image->getRealPath();
            $image = @getimagesize($file);
            $content = file_get_contents($file);
        } elseif (is_resource($image)) {
            $content = stream_get_contents($image);
            $image = @getimagesizefromstring($content);
        } else {
            $image = false;
            $content = null;
        }

        $content = base64_encode($content);

        $bool = $image !== false;

        if (!$bool) {
            return false;
        }

        if (is_null($format)) {
            // not check format
            if ($returnBase64Encode) {
                return $content;
            }

            return true;
        }

        // check format

        if (is_array($format)) {
            $bool = in_array(static::getImageFormat($image), $format);
        } else {
            $bool = static::getImageFormat($image) === $format;
        }

        if (!$bool) {
            return false;
        }

        if ($returnBase64Encode) {
            return $content;
        }

        return true;
    }
396527
public function applyToImage(Image $image, $x = 0, $y = 0)
    {
        $background = new Color($this->background);
        imagefilledrectangle($image->getCore(), $this->x1, $this->y1, $this->x2, $this->y2, $background->getInt());

        if ($this->hasBorder()) {
            $border_color = new Color($this->border_color);
            imagesetthickness($image->getCore(), $this->border_width);
            imagerectangle($image->getCore(), $this->x1, $this->y1, $this->x2, $this->y2, $border_color->getInt());
        }

        return true;
    }
351755
private function storeImage(Image $image)
    {
        $file = $this->getFile($image);

        if (!$file instanceof \SplFileInfo) {
            return null;
        }

        $path = $this->imageManagerInterface->store($file);

        return $image->setPath($path);
    }
509202
public function execute($image)
    {
        $diameter = $this->argument(0)->type('numeric')->required()->value();
        $x = $this->argument(1)->type('numeric')->required()->value();
        $y = $this->argument(2)->type('numeric')->required()->value();
        $callback = $this->argument(3)->type('closure')->value();

        $namespace = $image->getDriver()->getNamespace();
        $circleClassname = "\{$namespace}\Shapes\CircleShape";

        $circle = new $circleClassname($diameter);

        if ($callback instanceof Closure) {
            $callback($circle);
        }

        $circle->applyToImage($image, $x, $y);

        return true;
    }
1095966
public function execute($image)
    {
        $angle = $this->argument(0)->type('numeric')->required()->value();
        $color = $this->argument(1)->value();
        $color = new Color($color);

        // restrict rotations beyond 360 degrees, since the end result is the same
        $angle %= 360;

        // rotate image
        $image->getCore()->rotateImage($color->getPixel(), ($angle * -1));

        return true;
    }
713004
public function image($image)
    {
        $filePaths = loader()->getPublicDirs(true);
        $image = str_replace(['\\', '/'], DIRECTORY_SEPARATOR, $image);

        foreach ($filePaths as $filePath) {
            $filePath .= 'img' . DIRECTORY_SEPARATOR;

            if (is_file($filePath . $image)) {
                return path_to_url($filePath . $image);
                break;
            }

            unset($filePath);
        }
    }
470203
public function fill($image) {
        $fill = $this->getConfig('fill');
        $r = $fill[0];
        $g = $fill[1];
        $b = $fill[2];
        $a = isset($fill[3]) ? $fill[3] : 127;

        imagefill($image, 0, 0, imagecolorallocatealpha($image, $r, $g, $b, $a));

        return $image;
    }
913347
public function execute($image)
    {
        $format = $this->argument(0)->value();
        $quality = $this->argument(1)->between(0, 100)->value();

        $response = new Response($image, $format, $quality);

        $this->setOutput($response->make());

        return true;
    }