Skip to content

Instantly share code, notes, and snippets.

@Crystalsage
Last active September 11, 2020 17:40
Show Gist options
  • Save Crystalsage/391d6d56885ff7b099c82f5652892e69 to your computer and use it in GitHub Desktop.
Save Crystalsage/391d6d56885ff7b099c82f5652892e69 to your computer and use it in GitHub Desktop.
Script that converts GTA5 in-game snapshots (Snapmatic) into image viewer readable stuff. Just removes some metadata that's on top of the JPEG file signature. The metadata renders the image unviewable by default image viewers. Keep all of the image files and this script in one *separate* folder and run it. (Warning : Deletes original files)
import os
def readFiles():
return [f for f in os.listdir('.') if os.path.isfile(f) and not f.endswith(".py")]
#I hardcoded the magic byte offset. Should work nonetheless. The metadata we are removing contains date, although it has definite bytes
#allocated to it, and shouldn't generate stuff that has variable length.
def main(fileBuf):
for f in fileBuf:
with open(f, "r+b") as currFile, open(f"{f}.jpg", "wb") as destFile:
currFile = currFile.read()[292:]
destFile.write(currFile)
os.remove(f)
if __name__ == "__main__":
fileBuf = readFiles()
main(fileBuf)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment