import os from PIL import Image file_path = '/home/zbz5349/WorkSpace/aigeeks/ml-mgie/all' src_img_path = '/home/zbz5349/WorkSpace/aigeeks/Qwen2.5-VL/magicbrush_dataset/data' save_src_path = '/home/zbz5349/WorkSpace/aigeeks/ml-mgie/src_all_100' os.makedirs(save_src_path,exist_ok=True) idx = 0 for file in os.listdir(file_path): img_path = os.path.join(src_img_path, file) img = Image.open(img_path) save_img_path = os.path.join(save_src_path,file) img.save(save_img_path)