save_b64.py 351 B

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