Last active
August 14, 2020 17:34
-
-
Save smtchahal/893e88fa9a778f559fe73c2a6ef1764e to your computer and use it in GitHub Desktop.
GTA V Snapmatic to JPG converter
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 | |
# 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