Creates new image instance

@param  int     $width
@param  int     $height
@param  mixed   $background
@return \Intervention\Image\Image
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;
    }
16699
public function resize(int $width = 0, int $height = 0) : ImageInterface
    {
        $this->operations[] = [ __FUNCTION__, func_get_args() ];
        return $this;
    }
120750
public static function createBlankImage($width = 1, $height = 1)
    {
        $editorName = self::detectAvailableEditor();
        if ('Imagick' === $editorName) {
            return ImagickImage::createBlank($width, $height);
        } else {
            return GdImage::createBlank($width, $height);
        }
    }
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;
    }
507478
public function do_resize($width, $height)
    {
        if (version_compare(PHP_VERSION, '5.5.0') < 0) {
            $image = imagecreatetruecolor($width, $height);
            imagealphablending($image, false);
            imagesavealpha($image, true);

            imagecopyresampled($image, $this->_image, 0, 0, 0, 0, $width, $height, $this->_width, $this->_height);
        } else {
            $image = imagescale($this->_image, $width, $height);
        }

        imagedestroy($this->_image);
        $this->_image = $image;
        $this->_width = imagesx($image);
        $this->_height = imagesy($image);

        return $this;
    }
266936
public function crop(int $width, int $height): self
    {
        $this->image = $this->cropImage($this->image, $width, $height);
        return $this;
    }
809262
public function generateThumbnail($id, $width, $height = null)
	{
		if ($height === null)
		{
			$height = $width;
		}

		$temp = $this->container->download($id);

		$img = new \Imagick($temp->getPath());
		$img->cropThumbnailImage($width, $height);
		$img->writeImage();

		return $this->container->upload($temp);
	}
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);

    }
1095511
public static function canvas($width, $height, $background = null)
    {
        return self::getManager()->canvas($width, $height, $background);
    }
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;
    }
1315581
public function resize_strict( $width, $height ) 
	{
		// check dimensions
		if ( !( $width > 0 ) || !( $height > 0 ) ) 
		{
			throw new CCException( "CCImage::resize_strict - width and height can't be smaller then 1" );
		}

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

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

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

		// return self
		return $this;
	}
863524
public static function transparentImage(int $width, int $height): Image {
        $image = imagecreatetruecolor(max($width, 1), max($height, 1));
        $transparent = imagecolorallocatealpha($image, 0, 0, 0, 127);
        imagefill($image, 0, 0, $transparent);
        imagesavealpha($image, true);

        return new Image($image);
    }
1282342
public function runContainResize(Image $image, $width, $height)
    {
        return $image->resize($width, $height, function ($constraint) {
            $constraint->aspectRatio();
        });
    }
658745
public function createThumbnail($width, $height, $prefix = 'thumb_') {
		$imagick = new Imagick($this->dir.$this->filename);
		
		$width = min($width, $imagick->getImageWidth());
	 	$height = min($height, $imagick->getImageHeight());
		
		$bestfit = true;
		if($this->defaultDimension == 'width') {
			$height = 0;
			$bestfit = false;
		} else if($this->defaultDimension == 'height') {
			$width = 0;
			$bestfit = false;
		}
		$result = $imagick->thumbnailImage($width, $height, $bestfit);
		
		if($result !== false) {
			$thumbName = $this->createThumbName($this->filename, $prefix);
			$imagick->writeImage($this->dir.$thumbName);
			$imagick->clear();
			$imagick->destroy();
			
			return $thumbName;
		}
		
		return false;
	}
1216151
public function resize($width, $height)
    {
        $width = (int)$width;
        $height = (int)$height;
        $tmpImage = imagecreatetruecolor($width, $height);
        imagefilledrectangle($tmpImage, 0, 0, $width, $height, $this->backgroundColor);
        imagecopyresampled($tmpImage, $this->resource, 0, 0, 0, 0, $width, $height, $this->width, $this->height);
        $this->width = $width;
        $this->height = $height;
        $this->resource = $tmpImage;
    }
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;
    }
1024711
public function resize(int $width, int $height, bool $crop = false): self
    {
        $this->image = $this->resizeImage($this->image, $width, $height, $crop);
        return $this;
    }