Skip to content

Commit

Permalink
docs: Explanation of photo type and photo sheet size
Browse files Browse the repository at this point in the history
  • Loading branch information
aoguai committed Aug 6, 2024
1 parent e510fc1 commit 8577a95
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 26 deletions.
24 changes: 10 additions & 14 deletions docs/README-EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,6 @@ run_en.bat ./images/test1.jpg
python main.py --help
Usage: main.py [OPTIONS] IMG_PATH

Image Processing CLI Tools

IMG_PATH: Input Image Path

Options:
-y, --yolov8-model-path PATH Path to YOLOv8 model
-u, --yunet-model-path PATH Path to YuNet model
Expand All @@ -109,7 +105,7 @@ Options:
for image composition
-s, --save-path PATH Path to save the output image
-p, --photo-type TEXT Type of photo
--photo-sheet-size [5|6] Size of the photo sheet (5-inch or 6-inch)
--photo-sheet-size TEXT Size of the photo sheet
-c, --compress / --no-compress Whether to compress the image
-sc, --save-corrected / --no-save-corrected
Whether to save the corrected image
Expand All @@ -127,22 +123,22 @@ Options:
--help Show this message and exit.
```

#### Other Configuration
### Other Configuration

In this version, the standard ID photo configuration is set in `data/data.ini`, which you can use with the `photo-type` parameter.
In this version, the standard ID photo settings are configured in `data/data_en.ini`. You can use the `photo-type` and `photo-sheet-size` parameters.

You can also modify this configuration file to customize ID photo types. The format is as follows:
Additionally, you can modify this configuration file to customize the ID photo types. For the Chinese environment, the format is as follows:
```text
[XXX]
打印尺寸 = XXXcm x XXXcm
电子版尺寸 = XXXpx x XXXpx
分辨率 = XXXdpi
print_size = XXXcm x XXXcm
electronic_size = XXXpx x XXXpx
resolution = XXXdpi
```
The section name and `电子版尺寸 = XXXpx x XXXpx` are required.
The section name `[XXX]` and the line `electronic_size = XXXpx x XXXpx` are mandatory.

The section name represents the `photo-type` parameter.
The section name represents the values for the `photo-type` and `photo-sheet-size` parameters.

Currently, the `key` for size only supports the fixed Chinese `电子版尺寸` (Digital Size). This will be improved in future versions.
Furthermore, `photo-type` and `photo-sheet-size` also support direct input of strings in the format `XXXpx x XXXpx`, representing width and height.

## Acknowledgments

Expand Down
16 changes: 6 additions & 10 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,18 +97,14 @@ run.bat ./images/test1.jpg
python main.py --help
Usage: main.py [OPTIONS] IMG_PATH

图像处理 CLI 工具

IMG_PATH: 输入图像路径

Options:
-y, --yolov8-model-path PATH YOLOv8 模型路径
-u, --yunet-model-path PATH YuNet 模型路径
-r, --rmbg-model-path PATH RMBG 模型路径
-b, --bgr-list BGR_LIST BGR 通道值列表(逗号分隔),用于图像合成
-b, --bgr-list BGR_LIST BGR 通道值列表(英文逗号分隔),用于图像合成
-s, --save-path PATH 保存路径
-p, --photo-type TEXT 照片类型
--photo-sheet-size [5|6] 选择照片表格的尺寸(五寸或六寸)
--photo-sheet-size TEXT 选择照片表格的尺寸
-c, --compress / --no-compress 是否压缩图像
-sc, --save-corrected / --no-save-corrected
是否保存修正图像后的图片
Expand All @@ -128,9 +124,9 @@ Options:

#### 其他配置

在该版本中,在`data/data.ini`中设置了常规的证件照配置,您可以在`photo-type`参数中使用。
在该版本中,在`data/data-zh.ini`中设置了常规的证件照配置,您可以在`photo-type``photo-sheet-size`参数中使用。

同时你可以修改该配置文件,自定义证件照类型。其格式为
同时你可以修改该配置文件,自定义证件照类型。针对中文环境,其格式为
```text
[XXX]
打印尺寸 = XXXcm x XXXcm
Expand All @@ -139,9 +135,9 @@ Options:
```
其中节名称及`[XXX]``电子版尺寸 = XXXpx x XXXpx`是必须的。

其中节名称代表了其`photo-type`参数
其中节名称代表了其`photo-type``photo-sheet-size`参数输入值

目前,针对尺寸大小的 `key` 只支持固定中文 `电子版尺寸`,将在以后版本改进
同时`photo-type``photo-sheet-size`还支持直接输入形如`XXXpx x XXXpx`的字符串,代表宽高

## 致谢

Expand Down
4 changes: 2 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ def echo_message(key, **kwargs):
default=os.path.join(os.path.dirname(os.path.abspath(__file__)), 'model/RMBG-1.4-model.onnx'),
help='Path to RMBG model' if get_language() == 'en' else 'RMBG 模型路径')
@click.option('-b', '--bgr-list', type=BGRListType(), default='1.0,1.0,1.0',
help='BGR channel values list (comma-separated) for image composition' if get_language() == 'en' else 'BGR 通道值列表(逗号分隔),用于图像合成')
help='BGR channel values list (comma-separated) for image composition' if get_language() == 'en' else 'BGR 通道值列表(英文逗号分隔),用于图像合成')
@click.option('-s', '--save-path', type=click.Path(), default='output.jpg',
help='Path to save the output image' if get_language() == 'en' else '保存路径')
@click.option('-p', '--photo-type', type=str, default='一寸照片',
@click.option('-p', '--photo-type', type=str, default='one_inch_photo' if get_language() == 'en' else '一寸照片',
help='Type of photo' if get_language() == 'en' else '照片类型')
@click.option('--photo-sheet-size', type=str, default='five_inch_photo' if get_language() == 'en' else '五寸照片',
help='Size of the photo sheet' if get_language() == 'en' else '选择照片表格的尺寸')
Expand Down

0 comments on commit 8577a95

Please sign in to comment.