Skip to content

Instantly share code, notes, and snippets.

@hghwng
Created June 2, 2016 10:43
Show Gist options
  • Save hghwng/7ca4a67b0b760d09237b7ef62596c90e to your computer and use it in GitHub Desktop.
Save hghwng/7ca4a67b0b760d09237b7ef62596c90e to your computer and use it in GitHub Desktop.
Reconstruct GIF header from mobile QQ's stickers.
#!/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