Skip to content

Commit 3671aff

Browse files
committed
fix png alpha channel problem
1 parent e2c72be commit 3671aff

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

align.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ def image_align(src_file,
6161
)
6262
return
6363
img = PIL.Image.open(src_file)
64+
img = img.convert('RGB')
6465

6566
# Shrink.
6667
shrink = int(np.floor(qsize / output_size * 0.5))
@@ -180,8 +181,16 @@ def get_file(src, tgt):
180181
python align_images.py /raw_images /aligned_images
181182
"""
182183
parser = ArgumentParser()
183-
parser.add_argument("-i","--input_imgs_path", type=str, default = "imgs",help = "input images directory path")
184-
parser.add_argument("-o","--output_imgs_path", type=str, default = "imgs_align",help = "output images directory path")
184+
parser.add_argument("-i",
185+
"--input_imgs_path",
186+
type=str,
187+
default="imgs",
188+
help="input images directory path")
189+
parser.add_argument("-o",
190+
"--output_imgs_path",
191+
type=str,
192+
default="imgs_align",
193+
help="output images directory path")
185194

186195
args = parser.parse_args()
187196

@@ -193,10 +202,10 @@ def get_file(src, tgt):
193202

194203
# RAW_IMAGES_DIR = sys.argv[1]
195204
# ALIGNED_IMAGES_DIR = sys.argv[2]
196-
RAW_IMAGES_DIR = args.input_imgs_path
205+
RAW_IMAGES_DIR = args.input_imgs_path
197206
ALIGNED_IMAGES_DIR = args.output_imgs_path
198207

199-
if not osp.exists(ALIGNED_IMAGES_DIR): os.makedirs(ALIGNED_IMAGES_DIR)
208+
if not osp.exists(ALIGNED_IMAGES_DIR): os.makedirs(ALIGNED_IMAGES_DIR)
200209

201210
files = os.listdir(RAW_IMAGES_DIR)
202211
print(f'total img files {len(files)}')

0 commit comments

Comments
 (0)