Transparent BG
Before Width: | Height: | Size: 27 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 9.8 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 22 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
BIN
old/img/01/04/ndc.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
old/img/01/07/matrix_multiplication.png
Normal file
After Width: | Height: | Size: 9.8 KiB |
BIN
old/img/01/07/vectors.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
old/img/01/07/vectors_addition.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
old/img/01/07/vectors_scale.png
Normal file
After Width: | Height: | Size: 20 KiB |
BIN
old/img/01/07/vectors_subtraction.png
Normal file
After Width: | Height: | Size: 22 KiB |
BIN
old/img/01/07/vectors_triangle.png
Normal file
After Width: | Height: | Size: 18 KiB |
@@ -52,6 +52,8 @@
|
|||||||
<img alt="OpenGL Logo" src="../../img/opengl.jpg" class="right" />
|
<img alt="OpenGL Logo" src="../../img/opengl.jpg" class="right" />
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- 如果图片有背景颜色的话请使用tools目录下的`ClearBG.py`清除为透明
|
||||||
|
|
||||||
其他的class名称还有:
|
其他的class名称还有:
|
||||||
|
|
||||||
- clean
|
- clean
|
||||||
|
35
tools/ClearBG.py
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
"""
|
||||||
|
很简陋的一个颜色替换工具,当原图片有背景色的时候请使用这个将背景颜色清除。
|
||||||
|
|
||||||
|
运行需要Pillow,如果没有安装的话请输入以下指令安装:
|
||||||
|
$ pip install Pillow
|
||||||
|
|
||||||
|
输入颜色的时候请在每个值中间加一个空格。
|
||||||
|
常用的背景颜色有:
|
||||||
|
- 238 238 238 255
|
||||||
|
- 241 241 241 255
|
||||||
|
|
||||||
|
输入的颜色最终会被替换为透明,输出文件为'noBG.png'。
|
||||||
|
"""
|
||||||
|
|
||||||
|
from PIL import Image
|
||||||
|
|
||||||
|
file_name = input("Filename: ")
|
||||||
|
r, g, b, a = map(int, input("Color(R G B A): ").split())
|
||||||
|
|
||||||
|
if not (0 <= r <= 255 or 0 <= g <= 255 or 0 <= b <= 255 or 0 <= a <= 255):
|
||||||
|
print("Color value error, please input valid numbers(Range: 0-255).")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
img = Image.open(file_name)
|
||||||
|
img = img.convert('RGBA')
|
||||||
|
pixel = img.load()
|
||||||
|
|
||||||
|
for x in range(0, img.size[0]):
|
||||||
|
for y in range(0, img.size[1]):
|
||||||
|
if pixel[x, y] == (r, g, b, 255):
|
||||||
|
img.putpixel((x, y), (0, 0, 0, 0))
|
||||||
|
|
||||||
|
img.save('noBG.png')
|
21
tools/README.md
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# 工具
|
||||||
|
|
||||||
|
本目录中包含一些工具供翻译或校对时使用。
|
||||||
|
|
||||||
|
## ClearBG.py
|
||||||
|
|
||||||
|
很简陋的一个颜色替换工具,当原图片有背景色的时候请使用这个将背景颜色清除。
|
||||||
|
|
||||||
|
运行需要Pillow,如果没有安装的话请输入以下指令安装:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
$ pip install Pillow
|
||||||
|
```
|
||||||
|
|
||||||
|
输入颜色的时候请在每个值中间加一个空格。
|
||||||
|
常用的背景颜色有:
|
||||||
|
|
||||||
|
- 238 238 238 255
|
||||||
|
- 241 241 241 255
|
||||||
|
|
||||||
|
输入的颜色最终会被替换为透明,输出文件为'noBG.png'。
|