Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

font2img.py error #13

Closed
Shuolongbj opened this issue May 27, 2017 · 7 comments
Closed

font2img.py error #13

Shuolongbj opened this issue May 27, 2017 · 7 comments

Comments

@Shuolongbj
Copy link

:~/zi2zi$ python font2img.py --src_font=src.ttf \

               --dst_font=tgt.otf \
               --charset=CN \
               --sample_count=1000 \
               --sample_dir=dir \
               --label=0 \
               --filter=1 \
               --shuffle=1

Traceback (most recent call last):
File "font2img.py", line 120, in
args.sample_count, args.sample_dir, args.label, args.filter)
File "font2img.py", line 72, in font2img
src_font = ImageFont.truetype(src, size=char_size)
File "/Users/Ru/anaconda/envs/gan/lib/python2.7/site-packages/PIL/ImageFont.py", line 238, in truetype
return FreeTypeFont(font, size, index, encoding)
File "/Users/Ru/anaconda/envs/gan/lib/python2.7/site-packages/PIL/ImageFont.py", line 127, in init
self.font = core.getfont(font, size, index, encoding)
IOError: cannot open resource

@kaonashi-tyc thank you!

@kaonashi-tyc
Copy link
Owner

It seems you didn't provide the right path to your source font through src_font argument. You need to offer a valid ttf/otf font file to point to in order to run the script.

@Shuolongbj
Copy link
Author

@kaonashi-tyc thank you.where can i get the ttf/otf font file with the tutorial guide

@Ran-Pan
Copy link

Ran-Pan commented Oct 12, 2017

@Shuolongbj you can just google/baidu font ttf download

@echo-zhouzhou
Copy link

@Shuolongbj did you solve this problem?

@mircial
Copy link

mircial commented Jan 18, 2018

@Shuolongbj @kaonashi-tyc what is the specific process?

@Jiolen
Copy link

Jiolen commented May 9, 2019

@Shuolongbj @kaonashi-tyc what is the specific process?

你去百度搜索下载ttf或者otf格式的文件,下载好之后放在font2img.py 同一级。
比如我下载的是楷体和华文行楷,文件分别是:simkai.ttf 和 stxingka.ttf

@yao269220079
Copy link

似乎您没有通过src_font参数提供正确的源字体路径。您需要提供一个有效的ttf / otf字体文件来指向该脚本,以运行该脚本。

如何生成自己想要的字符而不是随机采样

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants