Merge pull request #4425 from radarhere/icns_fp

Fix saving bug in IcnsImagePlugin __main__
This commit is contained in:
Hugo van Kemenade 2020-02-17 13:59:27 +02:00 committed by GitHub
commit 53ece804c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -365,13 +365,12 @@ if __name__ == "__main__":
print("Syntax: python IcnsImagePlugin.py [file]")
sys.exit()
imf = IcnsImageFile(open(sys.argv[1], "rb"))
for size in imf.info["sizes"]:
imf.size = size
imf.load()
im = imf.im
im.save("out-%s-%s-%s.png" % size)
im = Image.open(sys.argv[1])
im.save("out.png")
if sys.platform == "windows":
os.startfile("out.png")
with open(sys.argv[1], "rb") as fp:
imf = IcnsImageFile(fp)
for size in imf.info["sizes"]:
imf.size = size
imf.save("out-%s-%s-%s.png" % size)
im = Image.open(sys.argv[1])
im.save("out.png")
if sys.platform == "windows":
os.startfile("out.png")