细节更新

This commit is contained in:
Luthics 2023-01-07 00:16:44 +08:00
parent dccbbba5b0
commit dee4125942
1 changed files with 3 additions and 6 deletions

View File

@ -28,8 +28,8 @@ new_height = int(input("请输入新高度(px)"))
# new_height = 128
# 读入图片
imgFile = open(img, 'rb')
imgBytes = imgFile.read()
with open(img, 'rb') as f:
imgBytes = f.read()
# 文件头处理
# 检验文件头是否为 BM
@ -170,7 +170,4 @@ for i in range(len(newpixels)):
newimgBytes = bytes(newimgArray)
with open(img[:-4] + "_new" + img[-4:], 'wb') as f:
f.write(newimgBytes)
# 关闭文件
imgFile.close()
f.write(newimgBytes)