Skip to main content

智能图片背景移除命令行工具 (remove.bg API)

Project description

removebg-cli

智能图片背景移除命令行工具,基于 remove.bg API。

安装

pipx install removebg-cli

或使用 pip:

pip install removebg-cli

配置

设置环境变量(必须):

export REMOVE_BG_API_KEY='你的API密钥'
# 添加到 ~/.zshrc 或 ~/.bashrc 以持久化

获取 API Key: https://www.remove.bg/dashboard#api-key

使用

# 处理本地图片
removebg photo.jpg

# 处理网络图片 (自动识别URL)
removebg https://example.com/image.jpg

# 指定输出文件
removebg photo.jpg -o result.png

# 高清输出
removebg photo.jpg -s full

# 白色背景
removebg photo.jpg -b white

# 裁剪空白区域
removebg photo.jpg -c

# 查看账户余额
removebg --account

参数说明

参数 说明
-o, --output 输出文件路径
-s, --size 尺寸: auto/preview/full/50MP
-f, --format 格式: auto/png/jpg/webp/zip
-b, --bg 背景色: white/ff0000
-c, --crop 裁剪空白区域
--shadow 添加阴影
--account 查看余额

特性

  • 自动识别本地文件/URL
  • 默认透明PNG输出
  • 低额度警告 (≤10次)
  • 请求限流自动重试
  • 美化日志输出

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

removebg_cli-1.0.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

removebg_cli-1.0.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file removebg_cli-1.0.0.tar.gz.

File metadata

  • Download URL: removebg_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for removebg_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 aafd9995946b402f9b928708775f7928c7967f6caf02e38b6425f4c4c6dd138f
MD5 565bb7ea0b604510ca8b57a406ba63b6
BLAKE2b-256 5ee440d1b2c91f5313012d3052b27900470b5d89f33e551e571ce0da774c6517

See more details on using hashes here.

File details

Details for the file removebg_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: removebg_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.6

File hashes

Hashes for removebg_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 35d961d59bab5a16bc94058e58dd6cc157fa6fe331cb0f74de847222cd000654
MD5 6d96e55003d7a214a637809e2a1d1228
BLAKE2b-256 93329c0019b6c4a55462f558fdad2f52f489c0514bd8966665cce725831d9f31

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page