smertozturk/image_pixel_finder

这是一个工具,可以提供图像边缘的颜色权重,给定图像中最常用的颜色色调,或者任何像素的颜色色调。

dev-main 2024-05-07 19:35 UTC

This package is auto-updated.

Last update: 2024-09-07 20:21:49 UTC


README

这是一个工具,可以提供图像边缘的颜色权重,给定图像中最常用的颜色色调,或者任何像素的颜色色调。

安装

您可以通过Composer安装此包

composer require smertozturk/image_pixel_finder

使用方法

要使用此包,首先包含ImagePixelFinder类。然后,您可以使用ImagePixelFinder的3个方法;

use smertozturk\imagepixelfinder\ImagePixelFinder;

$imagePath = 'path/to/your/image.png';
$ipf = new ImagePixelFinder();

// Returns specific pixel color on given coordinates (#hex)
$x = 1;
$y = 1;
$pixelColor = $ipf->findPixelColor($imagePath, $x, $y);

// Returns the weighted color tones used around the edges of the image (Array of #hex (top, bottom, left, right))
$edgesColor = $ipf->findWeightColor($imagePath);

// Return most used color tone on image (#hex)
$edgesColor = $ipf->findWeightColor($imagePath);

贡献

如果您想为此包做出贡献,请将其Fork并提交一个pull request。您的贡献是受欢迎的!

许可证

此包采用MIT许可证。有关更多信息,请参阅LICENSE文件。