增加 README.md
This commit is contained in:
parent
f02e506e0a
commit
9bf3dd9cd7
|
@ -0,0 +1,12 @@
|
||||||
|
# bmp-resize-python
|
||||||
|
## Introduction
|
||||||
|
这是一个用 python 编写的 bmp 图片缩放器
|
||||||
|
|
||||||
|
和技术有关的说明在我的 Blog 中
|
||||||
|
|
||||||
|
[用 Python 优雅的缩放图片——计算机学科与技术导论大作业(1)](https://www.luthics.com/archives/77.html)
|
||||||
|
|
||||||
|
## Install
|
||||||
|
代码中使用了 tqdm 库来展示文件的进度,请使用下面的指令安装 tqdm
|
||||||
|
|
||||||
|
```pip install tqdm```
|
4
main.py
4
main.py
|
@ -71,7 +71,6 @@ while (rowLength % 4 != 0):
|
||||||
|
|
||||||
# 计算像素点
|
# 计算像素点
|
||||||
i = dataStart
|
i = dataStart
|
||||||
currentRow = 0
|
|
||||||
for currentRow in tqdm(range(height), "读入像素点中"):
|
for currentRow in tqdm(range(height), "读入像素点中"):
|
||||||
currentCol = 0
|
currentCol = 0
|
||||||
while (currentCol < width * (bpp // 8)):
|
while (currentCol < width * (bpp // 8)):
|
||||||
|
@ -224,9 +223,8 @@ for i in tqdm(range(len(newpixels)), "将像素点格式化中"):
|
||||||
newpixels[i][col]['b'], newpixels[i][col]['a']
|
newpixels[i][col]['b'], newpixels[i][col]['a']
|
||||||
]
|
]
|
||||||
newimgArray.extend(pixel)
|
newimgArray.extend(pixel)
|
||||||
else:
|
elif (mode == 1):
|
||||||
newimgArray.extend(flur(i, col))
|
newimgArray.extend(flur(i, col))
|
||||||
|
|
||||||
newimgArray.extend(sizeByte(0, rowLength - len(row) * (new_bpp // 8)))
|
newimgArray.extend(sizeByte(0, rowLength - len(row) * (new_bpp // 8)))
|
||||||
|
|
||||||
# 写入新的文件
|
# 写入新的文件
|
||||||
|
|
Loading…
Reference in New Issue