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

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

tinymeng/image
==============

图片合成，图片水印处理

v1.0.0(4y ago)0104MITPHPPHP &gt;=5.4

Since Mar 14Pushed 4y ago1 watchersCompare

[ Source](https://github.com/majiameng/php-image)[ Packagist](https://packagist.org/packages/tinymeng/image)[ Docs](https://github.com/majiameng/php-image)[ RSS](/packages/tinymeng-image/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

Image类库
=======

[](#image类库)

- 主体功能：图片合成，水印处理等
- author: tinymeng

1、使用场景
------

[](#1使用场景)

- 图片合成
- 文字水印

2、配置说明（默认配置如下）
--------------

[](#2配置说明默认配置如下)

```
$config = [

 /**
  * 水印字体(默认字体不支持中文，请按需配置需要的字体)
  */
 'font'       => __DIR__ . '/font.ttf',

 /**
  * 水印位置(1~9，9宫格位置，其他为随机)
 */
 'pos'        => 9,

 /**
  * 相对pos的x偏移量
  */
 'posX'       => 0,

 /**
  * 相对pos的y偏移量
  */
 'posY'       => 0,

 /*
  * 水印透明度
  * 填写0~100间的数字,100为不透明
 */
 'opacity'        => 100,

 /**
  * 透明度参数 alpha，其值从 0 到 127。0 表示完全不透明，127 表示完全透明
  */
 'alpha'         => 0,

 /*
  * 默认水印文字
  */
 'text'       => 'tinymeng',

 /*
  * 文字颜色 颜色使用16进制表示
 */
 'textColor' => '#FF4040',

 /*
  * 文字大小
  */
 'textSize'  => 12,

 ];

```

3、方法说明
------

[](#3方法说明)

### 类初始化

[](#类初始化)

- \_\_construct($image, array $config = \[\])

参数值是否必传image原图片路径是config配置数组，根据业务自定义配置，无则为默认值否### 往原图添加水印图片

[](#往原图添加水印图片)

- waterImg($waterImg, $pos, $opacity = 0, $posX = 0, $posY = 0)

参数值是否必传waterImg水印图片路径是pos水印位置否opacity透明度否posX位置x偏移量否posY位置y偏移量否### 往原图添加水印文字

[](#往原图添加水印文字)

- waterText($text, $pos = 0, $textColor = '', $textSize = 0, $alpha = 0, $posX = 0, $posY = 0)

参数值是否必传text水印文字是pos水印位置否textColor颜色否textSize文字size否alpha透明度否posX位置x偏移量否posY位置y偏移量否### 设置水印文字类型文件

[](#设置水印文字类型文件)

- setFont($font)

参数值是否必传font文字字体文件路径是### 输出图片（类型为png）

[](#输出图片类型为png)

- save($outImg, $name = 'out')

参数值是否必传outImg输出图片路径是，例子：项目路径/runtime/name输出图片名称否，默认out### 销毁图片资源，释放内存（save方法会默认调用，若无调用save方法，则要手动调用）

[](#销毁图片资源释放内存save方法会默认调用若无调用save方法则要手动调用)

- destroy() 无参数

4、使用
----

[](#4使用)

```
$a = __DIR__ . '/demo.png';

$image = new Watermark($a);

b = __DIR__ . '/';

$c = __DIR__ . '/water.png';

$image->waterText('zzwtestd', 8)->waterImg($c, 2, 50)->save($b);

```

5、安装使用
------

[](#5安装使用)

```
composer require tinymeng/image

```

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

1527d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/f00d0a29ab429fef8e40769a695213a7adcaff7cb9ba6dc1eb77e0d9655e0618?d=identicon)[tinymeng](/maintainers/tinymeng)

---

Top Contributors

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

---

Tags

phpimagewater

### Embed Badge

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

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

###  Alternatives

[stefangabos/zebra_image

A single-file, lightweight PHP library designed for efficient image manipulation featuring methods for modifying images and applying filters

141110.4k6](/packages/stefangabos-zebra-image)[dantsu/php-image-editor

PHP library to easily edit image with GD extension.

34152.1k2](/packages/dantsu-php-image-editor)[javion/image

图片合成，图片水印处理

121.5k](/packages/javion-image)[lciolecki/php-image-optimizer

PHP image file optimizer (uses https://github.com/bensquire/php-image-optim)

347.4k](/packages/lciolecki-php-image-optimizer)

PHPackages © 2026

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