@param ImagineImageInterface $image

@return ImagineImagineInterface
185064
public function updateFile(ImagineImageInterface $image = null)
    {
        if ($image === null) {
            $image = $this->image;
        }

        $target = $this->getTargetSize(
            $image->getSize()->getWidth(),
            $image->getSize()->getHeight(),
            $this->targetWidth,
            $this->targetHeight
        );

        $resize = new ImagineResize(
            new Box($target['width'], $target['height'])
        );

        $image = $resize->apply($image);

        return $image;
    }
380481
public function canBeApplied(ImagineImageInterface $image)
    {
        $expectedDimensions = $this->calculateDimensions($image->getSize());

        return ((string)$expectedDimensions !== (string)$image->getSize());
    }
506187
public function updateFile(ImagineImageInterface $image)
    {
        $this->originWidth = $image->getSize()->getWidth();
        $this->originHeight = $image->getSize()->getHeight();

        // Resize 
        $this->resize();

        $resize = new ImagineResize(
            new Box($this->resizeWidth, $this->resizeHeight)
        );
        $image = $resize->apply($image);

        // Crop
        $this->crop();
        $crop = new ImagineCrop(
            new Point($this->targetLeft, $this->targetTop),
            new Box($this->targetWidth, $this->targetHeight)
        );

        $image = $crop->apply($image);

        return $image;
    }
628356
public function run(Image $image)
    {
        $sharpen = $this->getSharpen();

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

        return $image;
    }
519371
final public function make(ImageInterface $image)
    {
        $this->response = new Response(null, 200);
        $this->response->setPublic();

        $lastMod = (new \DateTime)->setTimestamp($modDate = $image->getLastModTime());
        $mod = strtotime($this->request->headers->get('if-modified-since', time()));

        if (($image instanceof CachedImage || !$image->isProcessed()) && $mod === $modDate) {
            $this->setHeadersIfNotProcessed($this->response, $lastMod);
        } else {
            $this->setHeaders($this->response, $image, $lastMod);
        }
    }
838194
public function loadFromString($image)
    {
        $resource = @imagecreatefromstring($image);

        if (!is_resource($resource)) {
            throw new Exception\RuntimeException('image could not be loaded');
        }

        return $resource;
    }
293543
public function apply( $image ) {

        imagefilter($image->getCore(), IMG_FILTER_COLORIZE, $this->red, $this->green, $this->blue);
        return $image;
    }
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;
    }
365804
public function loadImage($image)
    {
        $imageLibrary = ucfirst($this->imageLibrary);
        $functionName = 'loadWith' . $imageLibrary;
        $this->image = $image;

        if (!method_exists($this, $functionName)) {
            throw new IcrRuntimeException('Wrong image library name provided!');
        }

        return call_user_func([$this, $functionName]);
    }
19700
protected function render(ImageInterface $image)
    {
        $this->response->make($image);
        $image->close();

        return $this->response->getResponse();
    }
120604
public function updateFile(ImagineImageInterface $image)
    {
        if ($this->angle !== null && is_int($this->angle)) {
            $transformation = new Transformation();
            $transformation->rotate($this->angle, null);
            $transformation
                ->apply($image)
                ;
        }

        return $image;
    }
668166
public function removeImage(\Elcodi\Component\Media\Entity\Interfaces\ImageInterface $image)
    {
        $this->images->removeElement($image);

        return $this;
    }
741290
public function imageInspect($image)
    {
        return $this->browser->get(
            $this->uri->expand(
                '/images/{image}/json',
                array(
                    'image' => $image
                )
            )
        )->then(array($this->parser, 'expectJson'));
    }
830152
public static function get(string $type): ImagineInterface
    {
        switch ($type) {
            case self::GD:
                return new GdImagine();
            case self::IMAGICK:
                return new ImagickImagine();
            case self::GMAGICK:
                return new GmagickImagine();
            default:
                throw new InvalidConfigException(sprintf('Image driver %s not found.', $type));
        }
    }
1008063
public function execute($image)
    {
        $level = $this->argument(0)->between(-100, 100)->required()->value();

        return imagefilter($image->getCore(), IMG_FILTER_CONTRAST, ($level * -1));
    }
880852
public function apply( $image ) {
        $image->getCore()->blurImage(1 * $this->amount, 0.5 * $this->amount);
        return $image;
    }
1360417
protected function resize(ImagineImageInterface $image, $mode = ImageInterface::RATIOMODE_INSET, $filter = ImagineImageInterface::FILTER_UNDEFINED)
    {
        if ($mode !== ImageInterface::RATIOMODE_INSET &&
            $mode !== ImageInterface::RATIOMODE_OUTBOUND
        ) {
            throw new \InvalidArgumentException('Invalid mode specified');
        }

        $imageSize = $image->getSize();
        $requestedDimensions = $this->calculateDimensions($imageSize);

        $image->strip();

        $resizeDimensions = $requestedDimensions;
        if ($mode === ImageInterface::RATIOMODE_OUTBOUND) {
            $resizeDimensions = $this->calculateOutboundScalingDimensions($imageSize, $requestedDimensions);
        }

        $image->resize($resizeDimensions, $filter);

        if ($mode === ImageInterface::RATIOMODE_OUTBOUND) {
            $image->crop(new Point(
                max(0, round(($resizeDimensions->getWidth() - $requestedDimensions->getWidth()) / 2)),
                max(0, round(($resizeDimensions->getHeight() - $requestedDimensions->getHeight()) / 2))
            ), $requestedDimensions);
        }

        return $image;
    }