dkerner / voronoi-obfuscate
创建源图像的混淆版本
dev-master
2022-01-29 15:15 UTC
Requires
- php: ^8.0
This package is not auto-updated.
Last update: 2024-09-22 03:19:02 UTC
README
这目前还在开发中,并不完全稳定。API 仍未最终确定,因此新版本可能会破坏代码!
voronoi-obfuscate
通过使用沃罗诺伊图(见 https://en.wikipedia.org/wiki/Voronoi_diagram)创建源图像的混淆版本
入门
也许你想从你的图像中制作“艺术”,或者你只是喜欢你的图像被混淆
输入(200x200像素)
结果
缩小到 100x100 像素
非等比例缩放到 400x100 像素
非等比例缩放到 100x400 像素
安装
composer require dkerner/voronoi-obfuscate "@dev"
用法
// create an obfuscated version of demo.jpg, store it as out.jpg // and create 500 points VoronoiObfuscator::createFromImagePath('demo.jpg', 'out.jpg', 500); // use config and resize the resulting image $config = new ObfuscatorConfig(); $config->setImagePath('demo.jpg') ->setOutputPath('out.jpg') ->setCellCount(1000) ->setOutputSize(400,800); VoronoiObfuscator::createFromConfig($config);
或者使用图像资源作为输入和输出
$config = new ObfuscatorConfig(); // set input $imageRessource = imagecreatefromjpeg('demo.jpg'); $config->setInputResource( $imageRessource ) ->setCellCount(100) ->setOutputSize(100,100); $processedImageRessource = VoronoiObfuscator::processImage($config); // use it further however needed imagejpeg( $processedImageRessource, 'out_processed.jpg');
作者
- 丹尼尔·克纳 - dkerner
许可证
本项目采用 MIT 许可证 - 有关详细信息,请参阅 LICENSE 文件
致谢
- https://github.com/sroze,使用了 sroze/PHP-Voronoi-algorithm 示例,这是一个很好的起点,并且目前使用了其 Nurbs 类
- https://github.com/zippex,需要图像混淆