PHPackages                             choowx/rasterize-svg - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Image &amp; Media](/categories/media)
4. /
5. choowx/rasterize-svg

ActiveLibrary[Image &amp; Media](/categories/media)

choowx/rasterize-svg
====================

A PHP library for converting SVG to JPEG, PNG, and WEBP

v0.1.2(1y ago)2283.6k↓29.9%10[3 PRs](https://github.com/choowx/rasterize-svg/pulls)MITPHPPHP ^8.1CI passing

Since Jan 5Pushed 1w ago1 watchersCompare

[ Source](https://github.com/choowx/rasterize-svg)[ Packagist](https://packagist.org/packages/choowx/rasterize-svg)[ Docs](https://github.com/choowx/rasterize-svg)[ GitHub Sponsors](https://github.com/choowx)[ RSS](/packages/choowx-rasterize-svg/feed)WikiDiscussions main Synced 2d ago

READMEChangelog (3)Dependencies (5)Versions (6)Used By (0)

A PHP library for converting SVG to JPEG, PNG, and WEBP
=======================================================

[](#a-php-library-for-converting-svg-to-jpeg-png-and-webp)

[![Latest Version on Packagist](https://camo.githubusercontent.com/69a2a1833d7bd5242665afa3c553e069ebfbe161e60f78da6ae79080b0854db8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f63686f6f77782f726173746572697a652d7376672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/choowx/rasterize-svg)[![Tests](https://camo.githubusercontent.com/2ef850bdcdf66c926e6ee38ffb9d008b20ebc1b661c86a8175998e382a749fb1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f616374696f6e732f776f726b666c6f772f7374617475732f63686f6f77782f726173746572697a652d7376672f72756e2d74657374732e796d6c3f6272616e63683d6d61696e266c6162656c3d7465737473267374796c653d666c61742d737175617265)](https://github.com/choowx/rasterize-svg/actions/workflows/run-tests.yml)[![Total Downloads](https://camo.githubusercontent.com/a75101f386f0cf961da287efcea597011c9be7bf36d7af2bb3a25da96c85101d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f63686f6f77782f726173746572697a652d7376672e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/choowx/rasterize-svg)

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require choowx/rasterize-svg
```

This package relies on the `sharp` js package being available on your system. In most cases you can accomplish this by issue this command in your project.

```
npm install sharp
```

Usage
-----

[](#usage)

```
use Choowx\RasterizeSvg\Svg;

$svgString = '
