arnapou/pixelsvg
最新稳定版本:v2.4.0
Composer 安装命令:
composer require arnapou/pixelsvg
包简介
Library - Simple library to convert pixelated images to svg.
README 文档
README
This library is a simple tool to convert pixelated images to SVG.
It optimises the svg file size by merging pixels in a single path.
Installation
composer require arnapou/pixelsvg
packagist 👉️ arnapou/pixelsvg
Renderer
The logic of the path rendering is in the Renderer you give to PixelSvg
| Renderers | Example 1 | Example 2 | Example 3 | Description |
|---|---|---|---|---|
| Original | ||||
ByPixelRenderer | One svg path by pixel. | |||
ByColorRenderer | One svg path by color. | |||
ByColorLayeredRenderer | One svg path by color + guessing overlapping layers to reduce the number of path points. | |||
SplitAnimationRenderer | Split the static pixels from the dynamic before calling the decorated renderer. |
| Color transforms injected in the renderer | Example 1 | Example 2 | Example 3 |
|---|---|---|---|
ByColorRenderer + GrayColorTransform | |||
ByColorRenderer + UniqueColorTransform |
From code
$filename = '/some/file/to/convert.gif';
$renderer = new \Arnapou\PixelSvg\Renderer\ByColorRenderer();
$pixelSvg = new \Arnapou\PixelSvg\PixelSvg($renderer);
$reader = new \Arnapou\PixelSvg\ImageReader\ImagickReader::fromFilename($filename);
$svgContent = $pixelSvg->render($reader);
⚠️ Prefer the use of Imagick for animated GIFs, because GD does not support it.
Php versions
| Date | Ref | 8.5 | 8.4 | 8.3 | 8.2 |
|---|---|---|---|---|---|
| 25/10/2025 | 2.4.x, main | × | × | × | |
| 25/11/2024 | 2.3.x | × | × | ||
| 26/11/2023 | 2.0 - 2.2 | × | |||
| 05/08/2023 | 1.x | × |
统计信息
- 总下载量: 25
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-08-05