Sets size to figure.

@access public
@param  int $width  Width.
@param  int $height Height.
@return \GImage\Figure
774659
public function setSize($width = 0, $height = 0)
    {
        if (!empty($width) && !empty($height)) {
            $this->width = $this->boxWidth = $width;
            $this->height = $this->boxHeight = $height;
        }

        return $this;
    }
16699
public function resize(int $width = 0, int $height = 0) : ImageInterface
    {
        $this->operations[] = [ __FUNCTION__, func_get_args() ];
        return $this;
    }
1178832
public function resize($width, $height, $scale = null)
	{
		if (null == $scale) {
			$scale = self::SCALE_AUTO;
		}
		
		$xy_scales = array(self::SCALE_EXACT, self::SCALE_CROP);
		if (in_array($scale, $xy_scales) && (empty($width) || empty($height))) {
			throw new Exception('Width and height must be non-zero integers');
		}
		else if (empty($width) && empty($height)) {
			throw new Exception('Width or height must be a non-zero integer');
		}
		
		$orig_x = $this->width();
		$orig_y = $this->height();
		
		// Handle auto scaling.
		if ($scale == self::SCALE_AUTO) {
			if (empty($height)) {
				$scale = self::SCALE_LANDSCAPE;
			}
			else if (empty($width)) {
				$scale = self::SCALE_PORTRAIT;
			}
			else if ($orig_y < $orig_x) {
				$scale = self::SCALE_LANDSCAPE;
			}
			else if ($orig_y > $orig_x) {
				$scale = self::SCALE_PORTRAIT;
			}
			else if ($height < $width) {
				$scale = self::SCALE_EXACT;
				$height = $width;
			}
			else {
				$scale = self::SCALE_EXACT;
				$width = $height;
			}
		}
		
		switch ($scale) {
			case self::SCALE_EXACT:
				break;
				
			case self::SCALE_PORTRAIT:
				$width = round($height * ($orig_x / $orig_y));
				$height = $height;
				break;
				
			case self::SCALE_LANDSCAPE:
				$height = round($width * ($orig_y / $orig_x));
				break;
				
			case self::SCALE_CROP:
				$given_width = $width;
				$given_height = $height;
				
				$ratio = max($height / $orig_y, $width / $orig_x);
				
				$height = round($orig_y * $ratio);
				$width  = round($orig_x * $ratio);
				break;
		}
		
		$new_image = imagecreatetruecolor($width, $height);
		$white = imagecolorallocate($new_image, 255, 255, 255);
		imagefill($new_image, 0, 0, $white);
		imagecopyresampled($new_image, $this->image, 0, 0, 0, 0, $width, $height, $orig_x, $orig_y);
		$this->image = $new_image;
		
		if ($scale == self::SCALE_CROP) {
			// Crop to the center.
			if ($width > $height) {
				$crop_start_x = ($width / 2) - ($given_width / 2);
				$crop_start_y = 0;
			}
			else {
				$crop_start_x = 0;
				$crop_start_y = ($height / 2) - ($given_height / 2);
			}
			
			$new_image = imagecreatetruecolor($given_width, $given_height);
			$white = imagecolorallocate($new_image, 255, 255, 255);
			imagefill($new_image, 0, 0, $white);
			imagecopyresampled(
				$new_image, $this->image, 0, 0, $crop_start_x, $crop_start_y,
				$given_width, $given_height, $given_width, $given_height
			);
			$this->image = $new_image;
		}
		
		return $this;
	}
61322
public function adaptiveResize($width, $height)
        {
            $this->resizeOut($width, $height);
            $this->crop(0, 0, $width, $height);

            return $this;
        }
1054838
public function resize($width = 0, $height = 0) 
    {
        if ($width != 0 || $height != 0) {
            $width = $this->getNewWidth($width, $height);
            $height = $this->getNewHeight($width, $height);
        } else {
            $width = $this->imageInfo['width'];
            $height = $this->imageInfo['height'];
        }

        $this->destImageWidth = $width;
        $this->destImageHeight = $height;
        
        return $this;
    }
1047369
public function fitInto($width, $height=null)
    {

        $size = $width instanceof Size ? $width : new static($width, $height);

        if (!$size->isValid()) {
            return new static($size);
        }

        $myAspectRatio = $this->aspectRatio();

        $newWidth = $size->height() * $myAspectRatio;

        if ($newWidth <= $size->width()) {
            return new static($newWidth, $size->height());
        }

        return new static($size->width(), $size->width() / $myAspectRatio);
    }
242253
public function size(Int $width, Int $height) : Table
    {
        $this->attr['width']  = $width;
        $this->attr['height'] = $height;

        return $this;
    }
674163
public function resize($width, $height, $ratio = false, $interlace = false) {

		$image = ['width' => imagesx($this -> image), 'height' => imagesy($this -> image)];

		//Set width and height
		if($height == 0 && $width > 0) {
			$height = round($image['height'] / ($image['width'] / $width), 0);
		}
		elseif($width == 0 && $height > 0) {
			$width = round($image['width'] / ($image['height'] / $height), 0);
		}

		$x = 0;
		$y = 0;

		//Ratio
		if(true === $ratio) {

			$ratio 		= [$image['width'] / $image['height'], $width / $height];
			$tmp_width 	= $image['width'];
			$tmp_height = $image['height'];

			if($ratio[0] > $ratio[1]) {

				$image['width'] = $image['height'] * $ratio[1];
				$x = ($tmp_width - $image['width']) / 2;
			}
			elseif($ratio[0] < $ratio[1]) {

				$image['height'] = $image['width'] / $ratio[1];
				$y = ($tmp_height - $image['height']) / 2;
			}
		}

		//Resizing
		return $this -> createImage($x, $y, $image['width'], $image['height'], $width, $height, $interlace);
	}
936540
public function resize(int $width = 0, int $height = 0)
    {
        if (!$width && !$height) {
            throw new ImageException('You must supply at least one dimension');
        }
        $iw = $this->info[0];
        $ih = $this->info[1];
        if (!$height || !$width) {
            if (!$width) {
                $width  = $height / $ih * $iw;
            }
            if (!$height) {
                $height = $width  / $iw * $ih;
            }
        }
        $di = imagecreatetruecolor($width, $height);
        imagecopyresized($di, $this->data, 0, 0, 0, 0, $width, $height, $iw, $ih);
        $this->data = $di;
    }
250187
protected function getNewWidth($width, $height) 
    {
        if ($width > 0) {
            return $width;
        }
        
        // original height : new height = original width : X
        return $height * $this->imageInfo['width'] / $this->imageInfo['height'];
    }
1036102
public function resize($width, $height)
    {
        $this->mode = 'resize';
        $this->targetSize = [$width, $height];
        $this->arguments = [];

        return $this->process();
    }
314065
public function scaleResize($width, $height) {

        // calculate source coordinates
        $kw = $this->width() / $width;
        $kh = $this->height() / $height;
        if($kh < $kw) {
            $src_h = $this->height();
            $src_y = 0;
            $src_w = round($kh * $width);
            $src_x = round(($this->width() - $src_w) / 2);
        } else {
            $src_h = round($kh * $height);
            $src_y = round(($this->height() - $src_h) / 2);
            $src_w = $this->width();
            $src_x = 0;
        }

        // copy new image
        $new = imagecreatetruecolor($width, $height);
        imagecopyresampled($new, $this->resource, 0, 0, $src_x, $src_y,
            $width, $height, $src_w, $src_h);
        $this->resource = $new;

        // for method chaining
        return $this;
    }
769740
public function scale($width, $height) {
		$image = new Image();
		$image->create($width, $height, $this->type);

		$result = $image->copyFromWithReSampling($this);

        $this->close();

		$this->image = $image->image;
		$image->setEmptyImage();
		$this->width = $width;
		$this->height = $height;
		return $result;
	}
594762
public function subtract($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);
    }
895159
protected function getImageSize($width, $height)
    {
        $min = min($width, $height);

        // if one value is zero, we have to calculate the right
        // value using the image aspect raion
        if (0 === $min) {

            // if both hight and widh are zero we assume
            // that the image is not resized at all
            if (0 === max($width, $height)) {
                extract($this->getInfo());
            } else {
                $ratio = $this->getInfo('ratio');
            }

            $width  = $width  === 0 ? (int) floor($height * $ratio) : $width;
            $height = $height === 0 ? (int) floor($width  / $ratio) : $height;
        }

        return compact('width', 'height');
    }
3623
public function limitImageSize($width, $height)
    {
        if ($this->maxImageSize !== null) {
            $imageSize = $width * $height;

            if ($imageSize > $this->maxImageSize) {
                $width = $width / sqrt($imageSize / $this->maxImageSize);
                $height = $height / sqrt($imageSize / $this->maxImageSize);
            }
        }

        return [
            (int) $width,
            (int) $height,
        ];
    }
508613
public function resize_fill( $width, $height ) 
	{
		$original_aspect = $this->width / $this->height;
		$thumb_aspect = $width / $height;

		if ( $original_aspect >= $thumb_aspect )
		{
		   $new_height = $height;
		   $new_width = $this->width / ($this->height / $height);
		}
		else
		{
		   $new_width = $width;
		   $new_height = $this->height / ($this->width / $width);
		}

		$x = 0 - ( $new_width - $width ) / 2;
		$y = 0 - ( $new_height - $height ) / 2;

		$result = imagecreatetruecolor( $width, $height );
		imagecopyresampled( $result, $this->image_context, $x, $y, 0, 0, $new_width, $new_height, $this->width, $this->height );

		// overwrite the image context 
		$this->image_context = $result;

		// update properties
		$this->reload_context_info();

		// return self
		return $this;
	}