kaonashi-tyc / zi2zi

Learning Chinese Character style with conditional GAN
https://kaonashi-tyc.github.io/2017/04/06/zi2zi.html
Apache License 2.0
2.54k stars 475 forks source link

image saving problem in font2img.py #11

Open handspeaker opened 7 years ago

handspeaker commented 7 years ago

hi @kaonashi-tyc , When I use font2img.py to generate jpg format images, I find the generated images have some noise around the strokes. I think it will degrade the training result more or less. Then after several experiments I find the problem lies in PIL image save function. Exactly in font2img.py line 87

e.save(os.path.join(sampledir, "%d%04d.jpg" % (label, count)))

I change this line by

e.save(os.path.join(sampledir, "%d%04d.jpg" % (label, count)), quality=100)

And the noise disappear.

roytam1 commented 7 years ago

I wonder if program accepts PNG? If so, using PNG is better since PNG is lossless format.

kaonashi-tyc commented 7 years ago

@handspeaker I will merge this once I tested it out on the exported model. The reason jpg is chosen is because it is inherited from the reference repo.