承接 arnapou/pixelsvg 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

arnapou/pixelsvg

最新稳定版本:v2.4.0

Composer 安装命令:

composer require arnapou/pixelsvg

包简介

Library - Simple library to convert pixelated images to svg.

README 文档

README

pipeline coverage

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

RenderersExample 1Example 2Example 3Description
Original 0.7 KB 0.9 KB 0.3 KB
ByPixelRenderer 18.4 KB 7.6 KB 25.5 KBOne svg path by pixel.
ByColorRenderer 2.0 KB 1.8 KB 4.9 KBOne svg path by color.
ByColorLayeredRenderer 1.6 KB 1.5 KB 4.5 KBOne svg path by color + guessing overlapping layers to reduce the number of path points.
SplitAnimationRenderer 1.6 KB 1.5 KB 4.0 KBSplit the static pixels from the dynamic before calling the decorated renderer.
Color transforms injected in the rendererExample 1Example 2Example 3
ByColorRenderer + GrayColorTransform 2.0 KB 1.8 KB 4.9 KB
ByColorRenderer + UniqueColorTransform 0.3 KB 0.3 KB 0.5 KB

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

DateRef8.58.48.38.2
25/10/20252.4.x, main×××
25/11/20242.3.x××
26/11/20232.0 - 2.2×
05/08/20231.x×

统计信息

  • 总下载量: 25
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-08-05