From 9bf3dd9cd71a6807e50e55ecc7c8bae18eedc770 Mon Sep 17 00:00:00 2001 From: Luthics Date: Sat, 7 Jan 2023 16:23:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20README.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 ++++++++++++ main.py | 4 +--- 2 files changed, 13 insertions(+), 3 deletions(-) create mode 100644 README.md 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))) # 写入新的文件