pbaylies / stylegan-encoder

StyleGAN Encoder - converts real images to latent space
Other
740 stars 182 forks source link

image alignment corrupts 32bit images #18

Closed eyaler closed 4 years ago

eyaler commented 5 years ago

when a padding is needed, the code in face_alignment will corrupt images with an alpha channel. fixed by:

img = PIL.Image.open(src_file).convert('RGBA').convert('RGB')

pbaylies commented 5 years ago

@eyaler Thanks; I've seen this happen before. Feel free to submit a patch, or point me in the right direction, otherwise, I might track it down eventually...

eyaler commented 5 years ago

thanks. its just the above. in face_alignment.py replace: img = PIL.Image.open(src_file) with: img = PIL.Image.open(src_file).convert('RGBA').convert('RGB') this should also take care of your 'alpha' option