增加 README.md

This commit is contained in:
Luthics 2023-01-07 16:23:34 +08:00
parent f02e506e0a
commit 9bf3dd9cd7
2 changed files with 13 additions and 3 deletions

12
README.md Normal file
View File

@ -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```

View File

@ -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)))
# 写入新的文件 # 写入新的文件