src/SVG.php
public function toRasterImage($width, $height)
    {
        $docWidth  = $this->document->getWidth();
        $docHeight = $this->document->getHeight();
        $viewBox = $this->document->getViewBox();

        $rasterizer = new SVGRasterizer($docWidth, $docHeight, $viewBox, $width, $height);
        $this->document->rasterize($rasterizer);

        return $rasterizer->finish();
    }
public function toRasterImage($width, $height)
    {
        $docWidth  = $this->document->getWidth();
        $docHeight = $this->document->getHeight();
        $viewBox = $this->document->getViewBox();

        $rasterizer = new SVGRasterizer($docWidth, $docHeight, $viewBox, $width, $height);
        $this->document->rasterize($rasterizer);

        return $rasterizer->finish();
    }
public function toRasterImage ( $ width , $ height ) { $ docWidth = $ this -> document -> getWidth ( ) ; $ docHeight = $ this -> document -> getHeight ( ) ; $ viewBox = $ this -> document -> getViewBox ( ) ; $ rasterizer = new SVGRasterizer ( $ docWidth , $ docHeight , $ viewBox , $ width , $ height ) ; $ this -> document -> rasterize ( $ rasterizer ) ; return $ rasterizer -> finish ( ) ; }
Converts this image into a rasterized GD resource of the given size.

The resulting image resource supports transparency and represents the
SVG as accurately as possible (with PHP's limited imaging functions).
Note that, since images in SVG have an innate size, the given size only
scales the output canvas and does not influence element positions.

@param int $width  The target canvas's width, in pixels.
@param int $height The target canvas's height, in pixels.

@return resource The rasterized image as a GD resource (with alpha).
Converts this image into a rasterized GD resource of the given size .