public function newFromImage($value): Image
    {
        Utils::debugLog('newFromImage', [
            'instance' => $this,
            'arguments' => [$value]
        ]);

        $pixel = self::black(1, 1)->add($value)->cast($this->format);
        $image = $pixel->embed(
            0,
            0,
            $this->width,
            $this->height,
            ['extend' => Extend::COPY]
        );
        $image = $image->copy([
            'interpretation' => $this->interpretation,
            'xres' => $this->xres,
            'yres' => $this->yres,
            'xoffset' => $this->xoffset,
            'yoffset' => $this->yoffset
        ]);

        Utils::debugLog('newFromImage', ['result' => $image]);

        return $image;
    }
public function newFromImage($value): Image
    {
        Utils::debugLog('newFromImage', [
            'instance' => $this,
            'arguments' => [$value]
        ]);

        $pixel = self::black(1, 1)->add($value)->cast($this->format);
        $image = $pixel->embed(
            0,
            0,
            $this->width,
            $this->height,
            ['extend' => Extend::COPY]
        );
        $image = $image->copy([
            'interpretation' => $this->interpretation,
            'xres' => $this->xres,
            'yres' => $this->yres,
            'xoffset' => $this->xoffset,
            'yoffset' => $this->yoffset
        ]);

        Utils::debugLog('newFromImage', ['result' => $image]);

        return $image;
    }
public function newFromImage ( $ value ) : Image { Utils :: debugLog ( 'newFromImage' , [ 'instance' => $ this , 'arguments' => [ $ value ] ] ) ; $ pixel = self :: black ( 1 , 1 ) -> add ( $ value ) -> cast ( $ this -> format ) ; $ image = $ pixel -> embed ( 0 , 0 , $ this -> width , $ this -> height , [ 'extend' => Extend :: COPY ] ) ; $ image = $ image -> copy ( [ 'interpretation' => $ this -> interpretation , 'xres' => $ this -> xres , 'yres' => $ this -> yres , 'xoffset' => $ this -> xoffset , 'yoffset' => $ this -> yoffset ] ) ; Utils :: debugLog ( 'newFromImage' , [ 'result' => $ image ] ) ; return $ image ; }
Create a new image from a constant.

The new image has the same width, height, format, interpretation, xres,
yres, xoffset, yoffset as $this, but each pixel has the constant value
$value.

Pass a single number to make a one-band image, pass an array of numbers
to make an N-band image.

@param mixed $value The value to set each pixel to.

@throws Exception

@return Image A new Image.
Create a new image from a constant .