Skip to content

Instantly share code, notes, and snippets.

@smtchahal
Last active August 14, 2020 17:34
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smtchahal/893e88fa9a778f559fe73c2a6ef1764e to your computer and use it in GitHub Desktop.
Save smtchahal/893e88fa9a778f559fe73c2a6ef1764e to your computer and use it in GitHub Desktop.
GTA V Snapmatic to JPG converter
#!/usr/bin/env python3
# Converts GTA V's snapmatic files to JPG files.
# It basically removes the first 292 bytes from the file.
#
# Usage: python3 convert.py file1 file2 file3...
#
# Output is stored as file1.jpg, file2.jpg, file3.jpg
# in the same directory.
import os
import sys
OFFSET = 292
def convert(name):
with open(name, 'rb') as in_file:
with open(name + '.jpg', 'wb') as out_file:
out_file.write(in_file.read()[OFFSET:])
def main():
for name in sys.argv[1:]:
if os.path.isfile(name):
convert(name)
else:
print('WARNING: {} is not a file'.format(name), file=sys.stderr)
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment