From a961b87960f7e14da5c6e27a2c0fef0d4b94a3ab Mon Sep 17 00:00:00 2001 From: yutent Date: Fri, 28 Jul 2023 17:54:59 +0800 Subject: [PATCH] fixed --- notes/utils.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/notes/utils.py b/notes/utils.py index 4a6b5a2..8e437af 100644 --- a/notes/utils.py +++ b/notes/utils.py @@ -21,14 +21,15 @@ def get_monitor_info(monitor): def pixbuf_to_dict(pixbuf, filename = ''): - has_alpha = pixbuf.get_has_alpha() - - # 没有apha通道时, get_pixels() 得到像素矩阵会出现极个别像素出现alpha通道 - # 所以, 这里强制设置alpha通道为false, 补全像素矩阵的数据 - if not has_alpha: - pixbuf = pixbuf.add_alpha(False, 0, 0, 0) if pixbuf: + has_alpha = pixbuf.get_has_alpha() + + # 没有apha通道时, get_pixels() 得到像素矩阵会出现极个别像素出现alpha通道 + # 所以, 这里强制设置alpha通道为false, 补全像素矩阵的数据 + if not has_alpha: + pixbuf = pixbuf.add_alpha(False, 0, 0, 0) + image = { "width": pixbuf.get_width(), "height": pixbuf.get_height(),