PHPackages                             saopanda/image-make - 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. saopanda/image-make

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

saopanda/image-make
===================

使用GD库实现多图片与文字的合成处理

1.0(3y ago)101665MITPHP

Since Sep 2Pushed 3y agoCompare

[ Source](https://github.com/Saopanda/ImageMake)[ Packagist](https://packagist.org/packages/saopanda/image-make)[ RSS](/packages/saopanda-image-make/feed)WikiDiscussions master Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

ImageMake
=========

[](#imagemake)

[![img_2.png](img_2.png)](img_2.png)

使用GD库实现多图片与文字的合成处理

- 项目重写，发布为 composer 包方便使用
- 大幅删减和优化，完善的注释上手使用更简单
- 自带思源黑体，可免费商用无需担心版权

### 安装

[](#安装)

```
composer require saopanda/image-make

```

### 使用

[](#使用)

仅三个方法！支持链式调用，后面调用的会覆盖在前面之上 [![img.png](img.png)](img.png)[![img_1.png](img_1.png)](img_1.png)

#### ImageMakeConfig （可选）

[](#imagemakeconfig-可选)

提供了一些额外可更改的配置

- 默认透明度开启
- 全局默认字体大小 16，可在`str()`单独设置大小
- 默认第一个调用`img()`传入的图片会被作为底图
- 输出格式 `1=>GIF` `2=>JPG` `3=>PNG`，默认`png`
    - ⚠️ 所有待操作图片以及输出格式建议保持统一，可提升图片生成效率
- 默认自带思源黑体，指定其他字体时请使用系统绝对路径，或[参考文档](https://www.php.net/manual/zh/function.imagettftext.php) -&gt;`fontfile`

```
$config = new ImageMakeConfig();
$config
    ->alpha(true)               //  设置透明度支持
    ->fontSize(20)              //  设置默认字体大小
    ->exportSize(1920, 1080)    //  设置底图大小
    ->exportType(2)             //  设置输出图片格式
    ->font('/font/abc');        //  设置默认字体

ImageMake::new($config)；        //  传入 new()
ImageMake::new()；               //  使用默认设置
```

#### img() 叠加图片

[](#img-叠加图片)

- `$value` 图片路径 或 二进制字符串
- `$x`, `$y` 位置，叠加在底图的哪里，默认左上角 0,0
- `$new_width`, `$new_height` 把这张图拉伸为新宽高，不填为原图大小
- 当此图被作为底图使用时，`$x, $y, $new_width, $new_height `参数无效

```
public function img(string $value, int $x = 0, int $y = 0, int $new_width = 0, int $new_height = 0)
```

#### str() 叠加文字

[](#str-叠加文字)

- `$value` 要叠加的文字
- `$x`, `$y` 位置，注意：基点在文字左下角，非左上角
- `$config` 配置数组：

```
[
    'color'    =>  string 支持带透明度的16进制颜色,
    'size'     =>  int 字体大小,
    'wrap'     =>  false | array [
        20, //  int 多少字自动换行
        10  //  int 行高
    ],
    'font'     =>  string 字体路径,
    'deg'      =>  int 旋转角度，设置排列方向，效果：左到右、上到下
]
```

```
public function str(string $value, int $x = 0, int $y = 10, array $config = [])
```

#### get() 直接输出图片 或 输出图片文件路径

[](#get-直接输出图片-或-输出图片文件路径)

- `$filepath` 指定输出的相对路径 + 文件名，否则直接输出图像

```
public function get(string $filepath = null)
```

#### demo

[](#demo)

见 `./test/test.php`

快速启动测试

```
cd ./test/
php -S localhost:8080

```

### 其他

[](#其他)

- 思源黑体
- GD 和图像处理 函数

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity47

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1400d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2d60c6b23132aafa2557093dec25bb64b228ada0f64c4e45cc9f6e6b632429e7?d=identicon)[saopanda](/maintainers/saopanda)

---

Top Contributors

[![Saopanda](https://avatars.githubusercontent.com/u/33977628?v=4)](https://github.com/Saopanda "Saopanda (17 commits)")

### Embed Badge

![Health badge](/badges/saopanda-image-make/health.svg)

```
[![Health](https://phpackages.com/badges/saopanda-image-make/health.svg)](https://phpackages.com/packages/saopanda-image-make)
```

###  Alternatives

[goat1000/svggraph

Generates SVG graphs

135911.1k3](/packages/goat1000-svggraph)[gravatarphp/gravatar

Gravatar URL builder which is most commonly called as a Gravatar library

16653.6k2](/packages/gravatarphp-gravatar)[rsoury/wp-imgix

Rewrites WordPress image URLs to use ImgIX

167.2k](/packages/rsoury-wp-imgix)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
