Skip to content

Commit

Permalink
docs: qa add template tips
Browse files Browse the repository at this point in the history
  • Loading branch information
Zeyi-Lin committed Sep 18, 2024
1 parent 817c4ba commit 473b8bf
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
13 changes: 11 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,16 +361,25 @@ docker run -d -p 7860:7860 \

# Q&A

## 如何修改预设尺寸和颜色?
## 1. 如何修改预设尺寸和颜色?

- 尺寸:修改[size_list_CN.csv](demo/assets/size_list_CN.csv)后再次运行 `app.py` 即可,其中第一列为尺寸名,第二列为高度,第三列为宽度。
- 颜色:修改[color_list_CN.csv](demo/assets/color_list_CN.csv)后再次运行 `app.py` 即可,其中第一列为颜色名,第二列为Hex值。

## 如何修改水印字体?
## 2. 如何修改水印字体?

1. 将字体文件放到`hivision/plugin/font`文件夹下
2. 修改`hivision/plugin/watermark.py``font_file`参数值为字体文件名

## 3. 如何添加社交媒体模板照?

1. 将模板图片放到`hivision/plugin/template/assets`文件夹下。模板图片是一个4通道的透明png。
2.`hivision/plugin/template/assets/template_config.json`文件中添加最新的模板信息,其中`width`为模板图宽度(px),`height`为模板图高度(px),`anchor_points`为模板中透明区域的四个角的坐标(px);`rotation`为透明区域相对于垂直方向的旋转角度,>0为逆时针,<0为顺时针。
3.`demo/processor.py``_generate_image_template`函数中的`TEMPLATE_NAME_LIST`变量添加最新的模板名

<img src="assets/social_template.png" width="500">


<br>

# 📧 联系我们
Expand Down
15 changes: 12 additions & 3 deletions README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ English / [中文](README.md) / [日本語](README_JP.md) / [한국어](README_K
- [API Service Deployment](#️-deploy-api-service)
- [Docker Deployment](#-docker-deployment)
- [Contact Us](#-contact-us)
- [Q&A](#qa)
- [Contributors](#contributors)
- [Thanks for support](#thanks-for-support)
- [License](#lincese)
Expand Down Expand Up @@ -353,18 +354,26 @@ docker run -d -p 7860:7860 \

<br>

# 💻 Development Tips
# Q&A

## How to modify preset sizes and colors?
## 1. How to modify preset sizes and colors?

- Size: After modifying [size_list_EN.csv](demo/assets/size_list_EN.csv), run `app.py` again. The first column is the size name, the second column is the height, and the third column is the width.
- Color: After modifying [color_list_EN.csv](demo/assets/color_list_EN.csv), run `app.py` again. The first column is the color name, and the second column is the Hex value.

## How to Change the Watermark Font?
## 2. How to Change the Watermark Font?

1. Place the font file in the `hivision/plugin/font` folder.
2. Change the `font_file` parameter value in `hivision/plugin/watermark.py` to the name of the font file.

## 3. How to Add Social Media Template Photos?

1. Place the template image in the `hivision/plugin/template/assets` folder. The template image should be a 4-channel transparent PNG.
2. Add the latest template information to the `hivision/plugin/template/assets/template_config.json` file. Here, `width` is the template image width (px), `height` is the template image height (px), `anchor_points` are the coordinates (px) of the four corners of the transparent area in the template; `rotation` is the rotation angle of the transparent area relative to the vertical direction, where >0 is counterclockwise and <0 is clockwise.
3. Add the name of the latest template to the `TEMPLATE_NAME_LIST` variable in the `_generate_image_template` function of `demo/processor.py`.

<img src="assets/social_template.png" width="500">

<br>

# 📧 Contact Us
Expand Down
Binary file added assets/social_template.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 473b8bf

Please sign in to comment.