Skip to content

Commit 473b801

Browse files
committed
fix: add background to .pdn thumbnail
1 parent b0c72d0 commit 473b801

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/tagstudio/qt/previews/renderer.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,6 +1407,10 @@ def _pdn_thumb(filepath: Path) -> Image.Image | None:
14071407
if encoded_png:
14081408
decoded_png = base64.b64decode(encoded_png)
14091409
im = Image.open(BytesIO(decoded_png))
1410+
if im.mode == "RGBA":
1411+
new_bg = Image.new("RGB", im.size, color="#1e1e1e")
1412+
new_bg.paste(im, mask=im.getchannel(3))
1413+
im = new_bg
14101414
except Exception as e:
14111415
logger.error("Couldn't render thumbnail", filepath=filepath, error=type(e).__name__)
14121416

0 commit comments

Comments
 (0)