Created
June 2, 2016 10:43
-
-
Save hghwng/7ca4a67b0b760d09237b7ef62596c90e to your computer and use it in GitHub Desktop.
Reconstruct GIF header from mobile QQ's stickers.
This file contains 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 | |
from sys import argv | |
""" | |
Reconstruct GIF header from mobile QQ's stickers. | |
Get the stickers in /sdcard/Tencent/QQ*/.emotionsm/ | |
""" | |
def convert_bytes(data): | |
prefix = b'GIF89a\xc8\x00\xc8\x00' | |
return prefix + data[len(prefix):] | |
def convert_file(path_in, path_out): | |
open(path_out, 'wb').write(convert_bytes(open(path_in, 'rb').read())) | |
if __name__ == '__main__': | |
convert_file(argv[1], argv[1] + '.gif') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment