fkxxyz / ssfconv

Sogou input method skin file (.ssf file) converter, supports conversion to fcitx or fcitx5 format.
GNU General Public License v3.0
200 stars 25 forks source link

对有些皮肤文件,转换时会出现数值溢出的问题 #20

Open Feiyuqwq opened 2 months ago

Feiyuqwq commented 2 months ago

问题描述:在对某些皮肤文件进行fcitx5格式转换时出现报错:OverflowError: Python integer 493 out of bounds for uint8,报错位于222行,是对像素求平均值的时候出现的,由于此处使用的整数类型 uint8只能存储0-255,当加法结果超过255时,会导致溢出。 建议:把数据类型转化为int类型,这样可以解决该问题。 issue1 有此问题的皮肤文件: https://pinyin.sogou.com/d/skins/download.php?skin_id=607531&rf=cate_31

Feiyuqwq commented 2 months ago

不是批量转换这样做对运行效率的影响也不大,或者说其他方法的话比如用NumPy的mean函数直接计算平均值?

RadND commented 1 month ago

@Feiyuqwq fork了一下修了