细节更新
This commit is contained in:
parent
dccbbba5b0
commit
dee4125942
7
main.py
7
main.py
|
@ -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
|
||||
|
@ -171,6 +171,3 @@ newimgBytes = bytes(newimgArray)
|
|||
|
||||
with open(img[:-4] + "_new" + img[-4:], 'wb') as f:
|
||||
f.write(newimgBytes)
|
||||
|
||||
# 关闭文件
|
||||
imgFile.close()
|
Loading…
Reference in New Issue