zi2zi-pytorch icon indicating copy to clipboard operation
zi2zi-pytorch copied to clipboard

AttributeError: 'NoneType' object has no attribute 'tobytes'

Open fanabcd opened this issue 1 year ago • 4 comments

python font2img.py --src_font='source.ttf' --dst_font='cao.ttf' --charset=CN --sample_count=1000 --sample_dir='images' --label=0 --filter --shuffle --mode=font2font 在使用如上命令的时候,应该是font2img.py文件里的这句: img = draw_single_char(c, font, canvas_size, x_offset, y_offset) 出错了,求解决方法

fanabcd avatar Feb 21 '24 08:02 fanabcd

linux下你拿到ttf了吗

wftree avatar Feb 25 '24 12:02 wftree

我已经运行好了(就是ttf文件的问题),老哥可以交流学习一下嘛。

fanabcd avatar Mar 02 '24 04:03 fanabcd

同楼上所说 遇到过相同的报错 更换ttf字体格式就好了 以下可以参考:

python font2img.py --src_font=charset/cjk/simfang.ttf \
                   --dst_font=charset/cjk/FZSTK.TTF \
                   --charset=CN \
                   --sample_count=1000 \
                   --sample_dir=dir \
                   --label=0 \
                   --filter \
                   --shuffle \
                   --mode=font2font

not-bald-owl avatar Apr 02 '24 07:04 not-bald-owl

看我PR的方案 可以不用更换字体解决该问题

not-bald-owl avatar Apr 07 '24 07:04 not-bald-owl