import base64, os os.makedirs('examples/how/features', exist_ok=True) for i in range(1, 10): with open(f'examples/how/input_local_archive/{i}.jpeg', 'rb') as f: d = base64.b64encode(f.read()).decode() with open(f'examples/how/features/img{i}_b64.txt', 'w') as out: out.write(d) print(f'saved img{i}_b64.txt, len={len(d)}')