mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-08-13 08:44:45 +03:00
Close file pointer in __main__
This commit is contained in:
parent
bd7242228b
commit
6e130e9f63
|
@ -365,7 +365,8 @@ if __name__ == "__main__":
|
||||||
print("Syntax: python IcnsImagePlugin.py [file]")
|
print("Syntax: python IcnsImagePlugin.py [file]")
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
||||||
imf = IcnsImageFile(open(sys.argv[1], "rb"))
|
with open(sys.argv[1], "rb") as fp:
|
||||||
|
imf = IcnsImageFile(fp)
|
||||||
for size in imf.info["sizes"]:
|
for size in imf.info["sizes"]:
|
||||||
imf.size = size
|
imf.size = size
|
||||||
imf.save("out-%s-%s-%s.png" % size)
|
imf.save("out-%s-%s-%s.png" % size)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user