Adds (+) the width of another width and this height to another height.
Returns a new Size.

@param float|Size $width
@param float      $height (optional)

@return static
960492
public function add($width, $height=null)
    {
        if ($width instanceof Size) {
            $height = $width->height();
            $width = $width->width();
        }

        $height = $height ? $height : $width;

        return new static($this->width()+$width, $this->height()+$height);
    }
1209668
protected function imageResize($width, $height)
    {
        $width = (int) $width;
        $height = (int) $height;
        if ($width <= 0) {
            throw new BadMethodCallException('Invalid parameter width for command "resize"');
        }
        if ($height <= 0) {
            throw new BadMethodCallException('Invalid parameter height for command "resize"');
        }
        $this->image->resize(new Box($width, $height));
    }
220790
public function forceSize($width, $height, $saveAsNewFile = false)
    {
        $width = $width <= 0 ? round($this->getRatio() * $height) : $width;
        $height = $height <= 0 ? round($width / $this->getRatio()) : $height;


        return $this->modifyImageHelper(
            function (Imagick $imagick) use ($width, $height) {
                $imagick->resizeimage($width, $height, Imagick::FILTER_CATROM, 1);
            },
            function () use ($width, $height) {
                return $this->newForceImageSizeBasename($width, $height);
            },
            function (ImageFile $file) use ($width, $height) {
                $file->forceSize($width, $height);
            },
            $saveAsNewFile);

    }
941821
public function resize($width, $height, $x = 0, $y = 0)
    {
        if ( !$this->newImage )
        {
            $this->create($width, $height);
        }

        if ( !is_numeric($width) ) {
            throw new \InvalidArgumentException('$width must be numeric');
        }

        if ( !is_numeric($height) ) {
            throw new \InvalidArgumentException('$height must be numeric');
        }

        $type = $this->source['type'];

        imagecopyresampled(
            $this->newImage,
            $this->sourceImage,
            0, 0,
            $x, $y,
            $width, $height,
            $this->source['width'], $this->source['height']);

        return $this;
    }
965152
public function resizeToWidth($width)
    {
        $height = $this->getPropHeight($width);
        $this->resize($width, $height);

        return $this;
    }
983752
public function Fill($width, $height)
    {
        $width = $this->castDimension($width, 'Width');
        $height = $this->castDimension($height, 'Height');
        $variant = $this->variantName(__FUNCTION__, $width, $height);
        return $this->manipulateImage($variant, function (Image_Backend $backend) use ($width, $height) {
            if ($backend->getWidth() === $width && $backend->getHeight() === $height) {
                return $this;
            }
            return $backend->croppedResize($width, $height);
        });
    }
313005
public function resize($width = null, $height = null)
    {
        $this->styleAttributes['width'] = $width . 'px';
        $this->styleAttributes['height'] = $height . 'px';

        return $this;
    }
1002348
protected function calcImageSize($width, $height)
    {
        $newSize = array(
            'newWidth' => $width,
            'newHeight' => $height
        );

        if ($this->maxWidth > 0) {
            $newSize = $this->calcWidth($width, $height);

            if ($this->maxHeight > 0 && $newSize['newHeight'] > $this->maxHeight) {
                $newSize = $this->calcHeight($newSize['newWidth'], $newSize['newHeight']);
            }
        }

        if ($this->maxHeight > 0) {
            $newSize = $this->calcHeight($width, $height);

            if ($this->maxWidth > 0 && $newSize['newWidth'] > $this->maxWidth) {
                $newSize = $this->calcWidth($newSize['newWidth'], $newSize['newHeight']);
            }
        }

        $this->newDimensions = $newSize;
    }
157131
public function setResolution($width, $height)
    {
        $this->width = $width;
        $this->height = $height;
        return $this;
    }
547350
public function canvasImageResample($width, $height)
    {
        $oCanvas = imagecreatetruecolor($width, $height);
        imagecopyresampled($oCanvas, $this->oImg, 0, 0, 0, 0, $width, $height, imagesx($this->oImg), imagesy($this->oImg));
        $this->oImg = $oCanvas;
        return $this;
    }
403273
public function resize(int $width, int $height, bool $resample = true)
    {
        $this->actions_to_perform[] = ['resize', ['width' => $width, 'height' => $height, 'resample' => $resample]];

        return $this;
    }
1032047
public function resize($width, $height, $allow_enlarge = false)
    {
        if (!$allow_enlarge) {
            // if the user hasn't explicitly allowed enlarging,
            // but either of the dimensions are larger then the original,
            // then just use original dimensions - this logic may need rethinking

            if ($width > $this->getSourceWidth() || $height > $this->getSourceHeight()) {
                $width  = $this->getSourceWidth();
                $height = $this->getSourceHeight();
            }
        }

        $this->source_x = 0;
        $this->source_y = 0;

        $this->dest_w = $width;
        $this->dest_h = $height;

        $this->source_w = $this->getSourceWidth();
        $this->source_h = $this->getSourceHeight();

        return $this;
    }
363415
public static function createBlank($width = 1, $height = 1){

        return new self(imagecreatetruecolor($width, $height), '', $width, $height, ImageType::UNKNOWN);

    }
913999
public function add(Size $size): Size
    {
        $this->bit = $this->bit + $size->get('b');
        return $this;
    }
1279537
public function divide($width, $height=null)
    {
        if ($width instanceof Size) {
            $height = $width->height();
            $width = $width->width();
        }

        $height = $height ? $height : $width;

        return new static($this->width()/$width, $this->height()/$height);
    }
800986
public function resize($width, $height) {
		$image = imagecreatetruecolor($width, $height);
		imagealphablending($image, false);
		imagesavealpha($image, true);
		imagecopyresampled($image, $this->_image, 0, 0, 0, 0, $width, $height, $this->width, $this->height);
		imagedestroy($this->_image);
		$this->_image = $image;
		return $this;
	}
784593
public function setSize($width, $height)
    {
        $this->width = $width;
        $this->height = $height;
        $this->ratioX = $width / $height;
        $this->ratioY = $height / $width;

        return $this;
    }