定制 gblix/gfx-php 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

gblix/gfx-php

最新稳定版本:1.0.0

Composer 安装命令:

composer require gblix/gfx-php

包简介

The pure PHP graphics library

README 文档

README

This is the GBLIX fork of mike42/gfx-php. The upstream repository is no longer actively maintained. This fork targets PHP 8.2+ and is available as gblix/gfx-php on Packagist.

This library implements input, output and processing of raster images in pure PHP, so that image processing extensions (Gd, Imagick) are not required.

This allows developers to eliminate some portability issues from their applications.

Features

  • Format support includes PNG, GIF, BMP and the Netpbm formats.
  • Support for scaling, cropping, format conversion and colorspace transformations.
  • Pure PHP: This library does not require Gd, ImageMagick or GraphicsMagick extensions.

v1.0.0 changelog

  • Requires PHP 8.2+ (previously PHP 7.0+)
  • Full property type declarations across all classes
  • Full method return type declarations
  • Fixed implicit nullable parameter deprecations (PHP 8.1)
  • Fixed dynamic property deprecations (PHP 8.2)
  • Fixed PngHeader::getCompresssion() reading an undeclared property ($this->compresssion$this->compression)
  • Replaced deprecated string pseudo-callables with first-class callable syntax
  • PHPUnit upgraded to ^11
  • Removed composer.lock (library policy)
  • Docker support added

Quick start

Requirements

  • PHP 8.2 or newer
  • zlib extension, for reading PNG files

Installation

Install gblix/gfx-php with Composer:

composer require gblix/gfx-php

Basic usage

<?php
use Mike42\GfxPhp\Image;

$img = Image::fromFile('colorwheel256.png');
$img->write('test.gif');

Testing

All test commands run inside Docker — no local PHP installation required.

Build the image once:

docker build -t gfx-php-test .

Run all PHPUnit tests (unit + integration):

docker run --rm gfx-php-test

Run only the unit tests:

docker run --rm gfx-php-test php vendor/bin/phpunit --testsuite unit

Run only the integration tests (reads real image files from test/resources/):

docker run --rm gfx-php-test php vendor/bin/phpunit --testsuite integration

Run benchmarks (PHPBench, scale/convert/codec operations):

docker run --rm gfx-php-test php vendor/bin/phpbench run --report=aggregate

Test layout

Path What it covers
test/unit/ Individual classes (image operations, LZW codec, format en/decoders)
test/integration/ Round-trip reads of real image files (BMP Suite, PyGIF, pngsuite)
test/benchmark/ PHPBench benchmarks for scale, convert and codec operations

Further reading

Contributing

This project is open to all kinds of contributions, including suggestions, documentation fixes, examples, formats and image processing algorithms.

See the issue tracker. Code contributions must be releasable under LGPL-2.1-or-later.

Scope

As a small project, we can't do everything. In particular, gfx-php is not likely to ever perform non-raster operations:

  • vector image formats (PDF, SVG, EPS, etc).
  • anything involving vector fonts

Acknowledgements

This repository uses test files from other projects:

Similar projects

  • Imagine, which wraps available libraries.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: LGPL-2.1-or-later
  • 更新时间: 2026-05-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固