import json import base64 import os with open('screenshot.png', 'r') as f: data = json.load(f) if 'image_base64' in data: with open('real_screenshot.png', 'wb') as img_file: img_file.write(base64.b64decode(data['image_base64'])) else: print("Format inattendu")