draco-development-group/remove-bg
Composer 安装命令:
composer require draco-development-group/remove-bg
包简介
A very small library to use your remove.bg api key to remove the background from your images and give you a transparent png
关键字:
README 文档
README
- You must get an api key from https://remove.bg
To install:
composer require draco-development-group/remove-bg
Quick Start:
Use the class
// Remember to require the composer autoloader
require_once __DIR__ . '/../vendor/autoload.php';
use DracoDevelopmentGroup\RemoveBg;
$bg = new RemoveBg('YOUR_API_KEY');
$bg->setOutputImageName('path/to/save/new/image/image_name', 'optionalFileType(.jpg or .png)');
$bg->setImageUrl('https://path/to/image.jpg');
$bg->save();
Full Documentation
You can set images from urls, or directly upload the image, or give a base64_encoded image:
- You may only use one of the following. If you attempt to use one of these after already setting an image, it will keep the last value you used.
$bg->setImageUrl(string); $bg->setImageFile(string($binary)); $bg->setImageFileB64(string);You can set backgrounds from urls, or directly upload the image, or give a color:
- You may only use one of the following. If you attempt to use one of these after already setting an image, it will keep the last value you used.
$bg->setBgColor(string); //can be hex or color name $bg->setBgImageUrl(string); $bg->setBgImageFile(string($binary));
You can set the following parameters as well
$bg->setSize(string); // preview (default), full, auto, etc
$bg->setType(string); //auto, person, product, car
$bg->setFormat(string); //auto, jpg, png
$bg->setRoi(string); //rectangle as x/y coordinates, <x1> <y1> <x2> <y2>
$bg->setCrop(boolean); //default false
$bg->setChannels(string); //rgba default
Full documentation also available in the class file
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 158
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-06-25