This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
convert_gbmp_to_zip.py | |
Reads an input file 1 bytes at a time and checks 4 bytes chunks. | |
If a 4-byte chunk equals 0x47 42 4D 50 (“GBMP”), | |
it is replaced with 0x50 4B 03 04 (“PK\x03\x04”) in the output. | |
The output is written next to the original file, but with a .zip suffix. | |
Afterwards the script checks the resulting file is a valid ZIP archive. | |
""" |