objement/imagick-canvas
Composer 安装命令:
composer require objement/imagick-canvas
包简介
Library to easily generate Imagick graphics containing pictures, texts and shapes.
README 文档
README
PHP-Library to easily generate Imagick graphics containing pictures, texts and shapes by writing object-oriented PHP code.
Installation
The library is available on Packagist and can therefore be installed using Composer.
composer require objement/imagick-canvas
Examples
Create a centered watermark image
$image = new OmElementImage($filepath); $canvas = new OmCanvas( OmCanvas::RESOLUTION_DEFAULT_SCREEN, // for web (resolution is important when working with texts) OmCanvas::COLORSPACE_RGB, // for web RGB, use CMYK for print $image->getWidth(), $image->getHeight() ); $canvas->addElement($image, OmElementPosition::create(OmUnit::UNIT_PIXELS, 0, 0)); $watermark = new OmElementImage(realpath('watermark.png'), $image->getWidth()->divide(5)); $canvas->addElement($watermark, OmElementPosition::create(OmUnit::UNIT_PIXELS, $image->getWidth()->divide(2)->subtract($watermark->getWidth()->divide(2)->getValue())->getValue(), // center it: (image width / 2) - (watermark width / 2) $image->getHeight()->divide(2)->subtract($watermark->getHeight()->divide(2)->getValue())->getValue() )); $canvas->getImage('png')->writeImage($filepath);
统计信息
- 总下载量: 9
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 3
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MPL-2.0
- 更新时间: 2021-03-08