diff --git a/README.md b/README.md new file mode 100644 index 0000000..f8bfb64 --- /dev/null +++ b/README.md @@ -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``` diff --git a/main.py b/main.py index dc7a23a..fe5ec04 100644 --- a/main.py +++ b/main.py @@ -71,7 +71,6 @@ while (rowLength % 4 != 0): # 计算像素点 i = dataStart -currentRow = 0 for currentRow in tqdm(range(height), "读入像素点中"): currentCol = 0 while (currentCol < width * (bpp // 8)): @@ -224,9 +223,8 @@ for i in tqdm(range(len(newpixels)), "将像素点格式化中"): newpixels[i][col]['b'], newpixels[i][col]['a'] ] newimgArray.extend(pixel) - else: + elif (mode == 1): newimgArray.extend(flur(i, col)) - newimgArray.extend(sizeByte(0, rowLength - len(row) * (new_bpp // 8))) # 写入新的文件