PHP code example of atelier / rasterizer

1. Go to this page and download the library: Download atelier/rasterizer library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

atelier / rasterizer example snippets


Rasterizer::create()->rasterize($svg, new BitmapOptions(width: 1200))->save('card.png');

use Atelier\Rasterizer\Bitmap\BitmapOptions;
use Atelier\Rasterizer\Rasterizer;

$bitmap = Rasterizer::create()->rasterize($svg, new BitmapOptions(
    width: 1200,
    height: 630,
    keepAspectRatio: true,
));

$bitmap->save('card.png');

use Atelier\Rasterizer\Svg\SvgInput;

SvgInput::fromString($markup);
SvgInput::fromFile('logo.svg');
SvgInput::fromStream($handle);