mirror of
https://github.com/xuthus83/LittlePaimon.git
synced 2024-10-21 16:27:15 +08:00
Merge pull request #394 from shenyanshu/Bot
修复实时便签绘制图片报错’百分比必须在0-1之间'的问题
This commit is contained in:
commit
2b86a6c108
@ -380,8 +380,12 @@ class PMImage:
|
||||
:param transparent: 是否透明
|
||||
"""
|
||||
if isinstance(percent, float):
|
||||
if percent < 0 or percent > 1:
|
||||
raise ValueError('百分比必须在0-1之间')
|
||||
if percent < 0:
|
||||
percent = -percent
|
||||
if percent > 10:
|
||||
raise ValueError('图片传入百分比错误')
|
||||
if percent > 1 and percent < 10:
|
||||
percent /= 10
|
||||
percent = [percent, 1 - percent]
|
||||
if isinstance(colors, str):
|
||||
colors = [colors, '#FFFFFF']
|
||||
|
Loading…
Reference in New Issue
Block a user