跳转到主要内容

用于添加边框到我的摄影图片的Python工具

项目描述

colorframe

一个简单的包,用于在图片上添加彩色边框。

安装

此代码与所有当前支持的Python版本兼容。它可以在虚拟环境中安装

python -m pip install colorframe

使用

在此包安装在激活环境中后,可以通过python -m colorframe调用。详细使用方法如下

 Usage: python -m colorframe [OPTIONS] [PATH]                                              
                                                                                           
 Add colored borders on pictures, easily.                                                  
                                                                                           
╭─ Arguments ─────────────────────────────────────────────────────────────────────────────╮
│   path      [PATH]  Location, relative or absolute, to the file or directory of files   │
│                     to add a colored border to.                                         │
│                     [default: None]                                                     │
╰─────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ───────────────────────────────────────────────────────────────────────────────╮
│ --left                      INTEGER  Width of the frame to add on the left image edge.  │
│                                      [default: 0]                                       │
│ --right                     INTEGER  Width of the frame to add on the right image edge. │
│                                      [default: 0]                                       │
│ --top                       INTEGER  Height of the frame to add on the top image edge.  │
│                                      [default: 0]                                       │
│ --bottom                    INTEGER  Height of the frame to add on the bottom image     │
│                                      edge.                                              │
│                                      [default: 0]                                       │
│ --color                     TEXT     The desired color of the added border. Should be a │
│                                      keyword recognized by Pillow.                      │
│                                      [default: white]                                   │
│ --log-level                 TEXT     The base console logging level. Can be 'debug',    │
│                                      'info', 'warning' and 'error'.                     │
│                                      [default: info]                                    │
│ --install-completion                 Install completion for the current shell.          │
│ --show-completion                    Show completion for the current shell, to copy it  │
│                                      or customize the installation.                     │
│ --help                               Show this message and exit.                        │
╰─────────────────────────────────────────────────────────────────────────────────────────╯

脚本将遍历文件,添加边框,并将结果导出到新创建的outputs文件夹中。

您还可以导入包中的高级对象,并按需使用。例如,要在文件夹中的所有图片的左侧添加150px的蓝色边框和底部添加72px的边框

from colorframe import BorderCreator

border_api = BorderCreator(
    commandline_pathp="path/to/images/",
    left_border=150,
    bottom_border=72,
    color="blue",
)
border_api.execute_target()

由fsoubelet用♥︎制作
MIT © 2020 Felix Soubelet

项目详情


下载文件

下载适用于您的平台的文件。如果您不确定选择哪个,请了解有关安装软件包的更多信息。

源分发

colorframe-0.3.0.tar.gz (7.1 kB 查看哈希值)

上传时间 源代码

构建分发包

colorframe-0.3.0-py3-none-any.whl (7.7 kB 查看哈希值)

上传时间 Python 3

由以下支持

AWS AWS 云计算和安全赞助商 Datadog Datadog 监控 Fastly Fastly CDN Google Google 下载分析 Microsoft Microsoft PSF 赞助商 Pingdom Pingdom 监控 Sentry Sentry 错误记录 StatusPage StatusPage 状态页面