2个版本
0.2.1 | 2024年7月7日 |
---|---|
0.2.0 | 2024年7月7日 |
139 in 图像
16KB
131 行
将指定的图像转换为适合X(原Twitter)头部的图像[^1]。
以下生成两个图像。
- 只有透明度的图像。
- 不仅透明度增加,而且大小调整并添加边距以适应X(原Twitter)头部。
默认文件名分别为 opaque.png
和 header.png
。可以通过指定下文所述的配置文件来更改设置。
安装
运行以下命令进行安装。
cargo install rating-graph-processor
用法
指定原始图像和输出目录作为参数。
运行 rating-graph-processor -h
时的帮助信息如下。
Converts the specified image to an image that fits the X (formerly Twitter) header
Usage: rating-graph-processor [OPTIONS] <ORIGINAL_IMAGE> <OUTPUT_DIR>
Arguments:
<ORIGINAL_IMAGE> Original image
<OUTPUT_DIR> Output directory for processed images
Options:
-c, --config <CONFIG> Configuration file
--header-only If this flag is specified, only images processed for headers will be generated. An image that has only been opaque will not be generated
-h, --help Print help
-V, --version Print version
配置
以下设置可用。
项目 | 描述 | 默认 |
---|---|---|
opaque_image | 仅透明度处理的图像文件名。 | opaque.png |
header_image | 用于X(原Twitter)头部的处理后的图像文件名。 | header.png |
filter | 调整图像大小时使用的采样过滤器类型。 | CatmullRom |
可以使用 --config
选项指定配置文件。配置文件使用TOML格式编写,每个设置都写入 settings
表中。
以下是一个配置文件的示例。
[settings]
# Filename of the image with opaque processing only.
# Default: opaque.png
opaque_image = "opaque.png"
# Filename of the processed for the X (formerly Twitter) header.
# Default: header.png
header_image = "header.png"
# Type of sampling filter to use when resizing the image.
# Available filters: [Nearest, Triangle, CatmullRom, GAussian, Lanczos3]
# Default: CatmullRom
filter = "CatmullRom"
[^1]: 头部图像大小为1500x500。
依赖项
~5MB
~96K SLoC