richarddobron/php-avg-color-picker 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

richarddobron/php-avg-color-picker

Composer 安装命令:

composer require richarddobron/php-avg-color-picker

包简介

The PHP Average Color Picker Library

README 文档

README

The PHP Average Color Picker Library

A simple, lightweight and fast PHP function that uses the GD library to extract the average color of an image.

Note

Keep in mind that this function will return the average color of an image, not the main color.

📖 Requirements

  • PHP 7.0 or higher
  • Composer is required for installation
  • PHP Extensions: ext-mbstring, ext-gd, ext-fileinfo, ext-ctype

📦 Installation

Install the library using Composer:

$ composer require richarddobron/php-avg-color-picker

👀 Example

Input - The Image Path

Input

Output - The Image Average Color

Output

⚡️ Quick Start

Here’s how to use the library to determine the average color of an image:

<?php

use Dobron\AvgColorPicker\Gd\AvgColorPicker;

$imageAvgRgbColor = (new AvgColorPicker)->getImageAvgRgb('image.png');
// or
$imageAvgRgbColor = (new AvgColorPicker)->getImageAvgRgb(imagecreatefrompng('image.png'));

var_dump($imageAvgRgbColor); // array(255, 255, 255)
<?php

use Dobron\AvgColorPicker\Gd\AvgColorPicker;

$imageAvgHexColor = (new AvgColorPicker)->getImageAvgHex('image.gif');
// or
$imageAvgHexColor = (new AvgColorPicker)->getImageAvgHex(imagecreatefromgif('image.gif'));

var_dump($imageAvgHexColor); // string(7) "#ffffff"

🧪 Testing

$ composer tests

🤝 Contributing

Please see CONTRIBUTING for details.

⚖️ License

This repository is MIT licensed, as found in the LICENSE file.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-08-10

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固