Skip to content

Instantly share code, notes, and snippets.

@zhuowei
Created November 28, 2022 00:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhuowei/5aaa7d475606e7a3bf156c63416d2396 to your computer and use it in GitHub Desktop.
Save zhuowei/5aaa7d475606e7a3bf156c63416d2396 to your computer and use it in GitHub Desktop.
import png
import sys
with open(sys.argv[1], "rb") as infile:
chunks = list(png.Reader(file=infile).chunks())
chunks.insert(1, (b"cICP", bytes([9, 16, 0, 1])))
with open(sys.argv[2], "wb") as outfile:
png.write_chunks(outfile, chunks)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment