nonebot_plugin_imagetools


Namenonebot_plugin_imagetools JSON
Version 0.4.2 PyPI version JSON
download
home_pagehttps://github.com/noneplugin/nonebot-plugin-imagetools
SummaryNonebot2 简单图片操作插件
upload_time2024-04-14 08:17:19
maintainerNone
docs_urlNone
authormeetwq
requires_python<4.0,>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # nonebot-plugin-imagetools

[Nonebot2](https://github.com/nonebot/nonebot2) 插件,用于一些简单图片操作


### 安装

- 使用 nb-cli

```
nb plugin install nonebot_plugin_imagetools
```

- 使用 pip

```
pip install nonebot_plugin_imagetools
```

#### 配置驱动器​

插件需要“客户端型驱动器”(如 httpx)来下载图片等,驱动器安装和配置参考 [NoneBot 选择驱动器](https://nonebot.dev/docs/advanced/driver)

同时需要在 `.env.*` 配置文件中启用对应的驱动器,例如:

```
DRIVER=~fastapi+~httpx+~websockets
```


### 配置项

#### `imagetools_multiple_image_config`
 - 类型:[MultipleImageConfig](https://github.com/noneplugin/nonebot-plugin-imagetools/blob/main/nonebot_plugin_imagetools/config.py)
 - 说明:输出多张图片时的发送方式

`MultipleImageConfig` 中的具体配置项:

##### `send_one_by_one`
 - 类型:`bool`
 - 默认:`False`
 - 说明:是否逐个发送图片,默认为 `False`,即一次性发送所有图片

##### `direct_send_threshold`
 - 类型:`int`
 - 默认:`10`
 - 说明:输出图片数量大于该数目时,不再直接发送,视配置以文件或合并转发消息的形式发送

##### `send_zip_file`
 - 类型:`bool`
 - 默认:`True`
 - 说明:输出图片数量大于 `direct_send_threshold` 时,是否打包为zip以文件形式发送

##### `send_forward_msg`
 - 类型:`bool`
 - 默认:`False`
 - 说明:输出图片数量大于 `direct_send_threshold` 时,是否发送合并转发消息

配置示例:
```
imagetools_multiple_image_config={"send_one_by_one":false,"direct_send_threshold":10,"send_zip_file":true,"send_forward_msg":true}
```


> [!NOTE]
>
> 本插件使用 [nonebot-plugin-alconna](https://github.com/nonebot/plugin-alconna) 插件来发送图片和文件,具体支持的平台和行为请参考该插件的文档


### 使用

**以下命令需要加[命令前缀](https://v2.nonebot.dev/docs/api/config#Config-command_start) (默认为`/`),可自行设置为空**

操作名 + [图片] 或 回复图片

发送“图片操作”可显示支持的指令列表


#### 支持的操作
 - 水平翻转/左翻/右翻
 - 竖直翻转/上翻/下翻
 - 旋转 + 角度
 - 缩放 + 尺寸或百分比,如:`缩放 100x100`;`缩放 200x`;`缩放 150%`
 - 裁剪 + 尺寸或比例,如:`裁剪 100x100`;`裁剪 2:1`
 - 反相/反色
 - 灰度图/黑白
 - 轮廓
 - 浮雕
 - 模糊
 - 锐化
 - 像素化 + 像素尺寸,默认为 8
 - 颜色滤镜 + 16进制颜色代码 或 颜色名称,如:`颜色滤镜 #66ccff`;`颜色滤镜 green`
 - 纯色图 + 16进制颜色代码 或 颜色名称
 - 渐变图 [+ 角度] + 颜色列表,如:`渐变图 红色 黄色`;`渐变图 45 红色 黄色`
 - gif倒放/倒放
 - gif正放倒放/正放倒放
 - gif变速 + 倍率,如:`gif变速 0.5x`;`gif变速 50%`
 - gif分解 [+ 间隔时间] + 至少两张图片,间隔时间默认为`100`,单位为`ms`
 - gif合成 + 至少两张图片
 - 四宫格
 - 九宫格
 - 横向拼接 + 至少两张图片
 - 纵向拼接 + 至少两张图片
 - 文字转图 + 文字,支持少量BBcode

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/noneplugin/nonebot-plugin-imagetools",
    "name": "nonebot_plugin_imagetools",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "meetwq",
    "author_email": "meetwq@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/b9/ca/cc7ded1badb294c29e558b0f158704e5583dc9ca3878f5bc5bc00ec14df4/nonebot_plugin_imagetools-0.4.2.tar.gz",
    "platform": null,
    "description": "# nonebot-plugin-imagetools\n\n[Nonebot2](https://github.com/nonebot/nonebot2) \u63d2\u4ef6\uff0c\u7528\u4e8e\u4e00\u4e9b\u7b80\u5355\u56fe\u7247\u64cd\u4f5c\n\n\n### \u5b89\u88c5\n\n- \u4f7f\u7528 nb-cli\n\n```\nnb plugin install nonebot_plugin_imagetools\n```\n\n- \u4f7f\u7528 pip\n\n```\npip install nonebot_plugin_imagetools\n```\n\n#### \u914d\u7f6e\u9a71\u52a8\u5668\u200b\n\n\u63d2\u4ef6\u9700\u8981\u201c\u5ba2\u6237\u7aef\u578b\u9a71\u52a8\u5668\u201d\uff08\u5982 httpx\uff09\u6765\u4e0b\u8f7d\u56fe\u7247\u7b49\uff0c\u9a71\u52a8\u5668\u5b89\u88c5\u548c\u914d\u7f6e\u53c2\u8003 [NoneBot \u9009\u62e9\u9a71\u52a8\u5668](https://nonebot.dev/docs/advanced/driver)\n\n\u540c\u65f6\u9700\u8981\u5728 `.env.*` \u914d\u7f6e\u6587\u4ef6\u4e2d\u542f\u7528\u5bf9\u5e94\u7684\u9a71\u52a8\u5668\uff0c\u4f8b\u5982\uff1a\n\n```\nDRIVER=~fastapi+~httpx+~websockets\n```\n\n\n### \u914d\u7f6e\u9879\n\n#### `imagetools_multiple_image_config`\n - \u7c7b\u578b\uff1a[MultipleImageConfig](https://github.com/noneplugin/nonebot-plugin-imagetools/blob/main/nonebot_plugin_imagetools/config.py)\n - \u8bf4\u660e\uff1a\u8f93\u51fa\u591a\u5f20\u56fe\u7247\u65f6\u7684\u53d1\u9001\u65b9\u5f0f\n\n`MultipleImageConfig` \u4e2d\u7684\u5177\u4f53\u914d\u7f6e\u9879\uff1a\n\n##### `send_one_by_one`\n - \u7c7b\u578b\uff1a`bool`\n - \u9ed8\u8ba4\uff1a`False`\n - \u8bf4\u660e\uff1a\u662f\u5426\u9010\u4e2a\u53d1\u9001\u56fe\u7247\uff0c\u9ed8\u8ba4\u4e3a `False`\uff0c\u5373\u4e00\u6b21\u6027\u53d1\u9001\u6240\u6709\u56fe\u7247\n\n##### `direct_send_threshold`\n - \u7c7b\u578b\uff1a`int`\n - \u9ed8\u8ba4\uff1a`10`\n - \u8bf4\u660e\uff1a\u8f93\u51fa\u56fe\u7247\u6570\u91cf\u5927\u4e8e\u8be5\u6570\u76ee\u65f6\uff0c\u4e0d\u518d\u76f4\u63a5\u53d1\u9001\uff0c\u89c6\u914d\u7f6e\u4ee5\u6587\u4ef6\u6216\u5408\u5e76\u8f6c\u53d1\u6d88\u606f\u7684\u5f62\u5f0f\u53d1\u9001\n\n##### `send_zip_file`\n - \u7c7b\u578b\uff1a`bool`\n - \u9ed8\u8ba4\uff1a`True`\n - \u8bf4\u660e\uff1a\u8f93\u51fa\u56fe\u7247\u6570\u91cf\u5927\u4e8e `direct_send_threshold` \u65f6\uff0c\u662f\u5426\u6253\u5305\u4e3azip\u4ee5\u6587\u4ef6\u5f62\u5f0f\u53d1\u9001\n\n##### `send_forward_msg`\n - \u7c7b\u578b\uff1a`bool`\n - \u9ed8\u8ba4\uff1a`False`\n - \u8bf4\u660e\uff1a\u8f93\u51fa\u56fe\u7247\u6570\u91cf\u5927\u4e8e `direct_send_threshold` \u65f6\uff0c\u662f\u5426\u53d1\u9001\u5408\u5e76\u8f6c\u53d1\u6d88\u606f\n\n\u914d\u7f6e\u793a\u4f8b\uff1a\n```\nimagetools_multiple_image_config={\"send_one_by_one\":false,\"direct_send_threshold\":10,\"send_zip_file\":true,\"send_forward_msg\":true}\n```\n\n\n> [!NOTE]\n>\n> \u672c\u63d2\u4ef6\u4f7f\u7528 [nonebot-plugin-alconna](https://github.com/nonebot/plugin-alconna) \u63d2\u4ef6\u6765\u53d1\u9001\u56fe\u7247\u548c\u6587\u4ef6\uff0c\u5177\u4f53\u652f\u6301\u7684\u5e73\u53f0\u548c\u884c\u4e3a\u8bf7\u53c2\u8003\u8be5\u63d2\u4ef6\u7684\u6587\u6863\n\n\n### \u4f7f\u7528\n\n**\u4ee5\u4e0b\u547d\u4ee4\u9700\u8981\u52a0[\u547d\u4ee4\u524d\u7f00](https://v2.nonebot.dev/docs/api/config#Config-command_start) (\u9ed8\u8ba4\u4e3a`/`)\uff0c\u53ef\u81ea\u884c\u8bbe\u7f6e\u4e3a\u7a7a**\n\n\u64cd\u4f5c\u540d + [\u56fe\u7247] \u6216 \u56de\u590d\u56fe\u7247\n\n\u53d1\u9001\u201c\u56fe\u7247\u64cd\u4f5c\u201d\u53ef\u663e\u793a\u652f\u6301\u7684\u6307\u4ee4\u5217\u8868\n\n\n#### \u652f\u6301\u7684\u64cd\u4f5c\n - \u6c34\u5e73\u7ffb\u8f6c/\u5de6\u7ffb/\u53f3\u7ffb\n - \u7ad6\u76f4\u7ffb\u8f6c/\u4e0a\u7ffb/\u4e0b\u7ffb\n - \u65cb\u8f6c + \u89d2\u5ea6\n - \u7f29\u653e + \u5c3a\u5bf8\u6216\u767e\u5206\u6bd4\uff0c\u5982\uff1a`\u7f29\u653e 100x100`\uff1b`\u7f29\u653e 200x`\uff1b`\u7f29\u653e 150%`\n - \u88c1\u526a + \u5c3a\u5bf8\u6216\u6bd4\u4f8b\uff0c\u5982\uff1a`\u88c1\u526a 100x100`\uff1b`\u88c1\u526a 2:1`\n - \u53cd\u76f8/\u53cd\u8272\n - \u7070\u5ea6\u56fe/\u9ed1\u767d\n - \u8f6e\u5ed3\n - \u6d6e\u96d5\n - \u6a21\u7cca\n - \u9510\u5316\n - \u50cf\u7d20\u5316 + \u50cf\u7d20\u5c3a\u5bf8\uff0c\u9ed8\u8ba4\u4e3a 8\n - \u989c\u8272\u6ee4\u955c + 16\u8fdb\u5236\u989c\u8272\u4ee3\u7801 \u6216 \u989c\u8272\u540d\u79f0\uff0c\u5982\uff1a`\u989c\u8272\u6ee4\u955c #66ccff`\uff1b`\u989c\u8272\u6ee4\u955c green`\n - \u7eaf\u8272\u56fe + 16\u8fdb\u5236\u989c\u8272\u4ee3\u7801 \u6216 \u989c\u8272\u540d\u79f0\n - \u6e10\u53d8\u56fe [+ \u89d2\u5ea6] + \u989c\u8272\u5217\u8868\uff0c\u5982\uff1a`\u6e10\u53d8\u56fe \u7ea2\u8272 \u9ec4\u8272`\uff1b`\u6e10\u53d8\u56fe 45 \u7ea2\u8272 \u9ec4\u8272`\n - gif\u5012\u653e/\u5012\u653e\n - gif\u6b63\u653e\u5012\u653e/\u6b63\u653e\u5012\u653e\n - gif\u53d8\u901f + \u500d\u7387\uff0c\u5982\uff1a`gif\u53d8\u901f 0.5x`\uff1b`gif\u53d8\u901f 50%`\n - gif\u5206\u89e3 [+ \u95f4\u9694\u65f6\u95f4] + \u81f3\u5c11\u4e24\u5f20\u56fe\u7247\uff0c\u95f4\u9694\u65f6\u95f4\u9ed8\u8ba4\u4e3a`100`\uff0c\u5355\u4f4d\u4e3a`ms`\n - gif\u5408\u6210 + \u81f3\u5c11\u4e24\u5f20\u56fe\u7247\n - \u56db\u5bab\u683c\n - \u4e5d\u5bab\u683c\n - \u6a2a\u5411\u62fc\u63a5 + \u81f3\u5c11\u4e24\u5f20\u56fe\u7247\n - \u7eb5\u5411\u62fc\u63a5 + \u81f3\u5c11\u4e24\u5f20\u56fe\u7247\n - \u6587\u5b57\u8f6c\u56fe + \u6587\u5b57\uff0c\u652f\u6301\u5c11\u91cfBBcode\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Nonebot2 \u7b80\u5355\u56fe\u7247\u64cd\u4f5c\u63d2\u4ef6",
    "version": "0.4.2",
    "project_urls": {
        "Homepage": "https://github.com/noneplugin/nonebot-plugin-imagetools",
        "Repository": "https://github.com/noneplugin/nonebot-plugin-imagetools"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5cfd42b37f27ed22439bb18ed3d9c78e24538c1f7866d619452b92ebeeb44176",
                "md5": "306bee16a657489508b340004f78d6fa",
                "sha256": "a908b6f50e7fb92f3e653645a2db23a56b84fdda709cf615366114f15a6f5b46"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_imagetools-0.4.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "306bee16a657489508b340004f78d6fa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 15425,
            "upload_time": "2024-04-14T08:17:17",
            "upload_time_iso_8601": "2024-04-14T08:17:17.640790Z",
            "url": "https://files.pythonhosted.org/packages/5c/fd/42b37f27ed22439bb18ed3d9c78e24538c1f7866d619452b92ebeeb44176/nonebot_plugin_imagetools-0.4.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b9cacc7ded1badb294c29e558b0f158704e5583dc9ca3878f5bc5bc00ec14df4",
                "md5": "4717630dd48a818237087c64705df9c2",
                "sha256": "423e66909804cf04712cab3f582ac3385eab3851af32e47549f070f9ff160458"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_imagetools-0.4.2.tar.gz",
            "has_sig": false,
            "md5_digest": "4717630dd48a818237087c64705df9c2",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 14252,
            "upload_time": "2024-04-14T08:17:19",
            "upload_time_iso_8601": "2024-04-14T08:17:19.179548Z",
            "url": "https://files.pythonhosted.org/packages/b9/ca/cc7ded1badb294c29e558b0f158704e5583dc9ca3878f5bc5bc00ec14df4/nonebot_plugin_imagetools-0.4.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-14 08:17:19",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "noneplugin",
    "github_project": "nonebot-plugin-imagetools",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nonebot_plugin_imagetools"
}
        
Elapsed time: 0.27525s