mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-02-13 18:11:02 +03:00
Close file pointer in __main__
This commit is contained in:
parent
bd7242228b
commit
6e130e9f63
|
@ -365,11 +365,12 @@ 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:
|
||||||
for size in imf.info["sizes"]:
|
imf = IcnsImageFile(fp)
|
||||||
imf.size = size
|
for size in imf.info["sizes"]:
|
||||||
imf.save("out-%s-%s-%s.png" % size)
|
imf.size = size
|
||||||
im = Image.open(sys.argv[1])
|
imf.save("out-%s-%s-%s.png" % size)
|
||||||
im.save("out.png")
|
im = Image.open(sys.argv[1])
|
||||||
if sys.platform == "windows":
|
im.save("out.png")
|
||||||
os.startfile("out.png")
|
if sys.platform == "windows":
|
||||||
|
os.startfile("out.png")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user