Create a blank image.

@param int $width Width in pixels.
@param int $height Height in pixels.

@return self
764991
public static function createBlank($width = 1, $height = 1){
        $imagick = new \Imagick();
        $imagick->newImage($width, $height, new \ImagickPixel('black'));
        $imagick->setImageFormat('png'); // Default to PNG.

        return new self( $imagick, '', $imagick->getImageWidth(), $imagick->getImageHeight(), $imagick->getImageFormat());

    }
165344
public static function getInstanceByCreate($width, $height)
    {
        $instance = new self();

        // set image dimensions
        $instance->width = (int)$width;
        $instance->height = (int)$height;

        $instance->createImage();

        return $instance;
    }
1237175
public function resize( $width = null, $height = null )
    {
        // Get the source width and height
        $sourceWidth = imagesx( $this->image );
        $sourceHeight = imagesy( $this->image );

        // Check if any of the width and height is null, and set it to the $source size
        // $width = $width ?: $sourceWidth;
        // $height = $height ?: $sourceHeight;
        $sourceAspectRatio = $sourceWidth / $sourceHeight;

        if ( !$width && !$height ) {
            $width = $sourceWidth;
            $height = $sourceHeight;
        }
        else if ( ! $width ) {
            $width = $height * $sourceAspectRatio;
        }
        else {
            $height = $width / $sourceAspectRatio;
        }

        $maxCanvasWidth = $width;
        $maxCanvasHeight = $height;

        $thumbnailAspectRatio = $maxCanvasWidth / $maxCanvasHeight;

        // Create canvas for the new image
        $canvas = $this->createCanvas( $width, $height );

        // Do the resizing of the image
        imagecopyresampled($canvas, $this->image, 0, 0, 0, 0, $width, $height, $sourceWidth, $sourceHeight);

        // Replace the current image
        $this->replace( $canvas );

        // Return this for linking
        return $this;
    }
354534
public function createThumbnail($width, $height, $prefix = 'thumb_') {
	 	return $this->imageProcessor->createThumbnail($width, $height, $prefix);
	 }
431572
public function newImage($width, $height, $background = null)
    {
        // create empty resource
        $core = imagecreatetruecolor($width, $height);
        $image = new \Intervention\Image\Image(new static, $core);

        // set background color
        $background = new Color($background);
        imagefill($image->getCore(), 0, 0, $background->getInt());

        return $image;
    }
136313
public function create(int $width, int $height, bool $true_color = true): bool
    {
        $this->image_width = $width;
        $this->image_height = $height;

        if (!$this->haveEnoughMemoryToOpenAndProcess()) {
            throw new RuntimeException('Empty can not be created.');
        }

        if ($true_color) {
            $img = imagecreatetruecolor($width, $height);
        } else {
            $img = imagecreate($width, $height);
        }

        $this->image_resource = $img;

        return true;
    }
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;
	}
235489
public function resizeOut($width, $height)
        {
            if (false === $this->_options['resizeUp']) {
                $this->_maxHeight = (intval($height) > $this->_sourceHeight) ? $this->_sourceHeight:$height;
                $this->_maxWidth = (intval($width) > $this->_sourceWidth) ? $this->_sourceWidth:$width;
            } else {
                $this->_maxHeight = intval($height);
                $this->_maxWidth = intval($width);
            }

            list($newWidth, $newHeight) = $this->_calcImageSizeStrict($this->_sourceWidth, $this->_sourceHeight);

            // resize the image to be close to our desired dimensions
            $this->resizeIn($newWidth, $newHeight);

            return $this;
        }
916561
protected function makeCircle($width, $height)
    {
        list($ox, $oy, $px, $py) = $this->getCoordinates($width, $height);

        $circle = new ImagickDraw();
        $circle->setFillColor('white');
        $circle->circle($ox, $oy, $px, $py);

        return $circle;
    }
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);
    }
242253
public function size(Int $width, Int $height) : Table
    {
        $this->attr['width']  = $width;
        $this->attr['height'] = $height;

        return $this;
    }
1305938
public function withDefaultImage(
        $width = null,
        $height = null,
        $options = null)
    {
        $this->withRenamedImage(null, null, $width, $height, $options);

        return $this;
    }
1145016
public function resize_overflow($width, $height) {

        $big = (($this->width / $this->height) > ($width / $height))
            ? ($this->width * $height) / $this->height
            : ($this->height * $width) / $this->width;
        $big = intval($big);

        $return = ($img = new gd($this->image, $big));

        if ($return) {
            $this->image = $img->get_image();
            $this->width = $img->get_width();
            $this->height = $img->get_height();
        }

        return $return;
    }
398815
public function resize($width, $height) {
        if ($width && $height) $this->thumb->resize($width, $height);
        else if (!$width) $this->thumb->resize(99999, $height);
        else if (!$height) $this->thumb->resize($width, 99999);
        return $this;
    }
255904
public function createThumbnail($name, $width, $height)
    {
        $this->addAction('thumbnail', $name, $width, $height);
        return $this;
    }
853524
public static function create($x, $y, $width, $height) : Box
    {
        return new self($x, $y, $width, $height);
    }
61322
public function adaptiveResize($width, $height)
        {
            $this->resizeOut($width, $height);
            $this->crop(0, 0, $width, $height);

            return $this;
        }