DF2K-OST / generate_meta_info.py
Iceclear's picture
Upload 3 files
7931fc7 verified
raw
history blame contribute delete
696 Bytes
import glob
import os
from os import path as osp
from PIL import Image
# print(len(sorted(glob.glob('GT_sub/*'))))
# raise NotImplementedError
with open('meta_info_DFO.txt', 'w') as f:
for idx, img_path in enumerate(sorted(glob.glob('GT_sub/*'))):
filename = osp.basename(img_path)
# img = Image.open(img_path) # lazy load
# width, height = img.size
# mode = img.mode
# if mode == 'RGB':
# n_channel = 3
# elif mode == 'L':
# n_channel = 1
# else:
# raise ValueError(f'Unsupported mode {mode}.')
info = f'{filename} (480,480,3)'
print(idx + 1, info)
f.write(f'{info}\n')