From 945d4ec68dda4b0a3d39127dadae887f60ba188d Mon Sep 17 00:00:00 2001 From: yyc12345 Date: Wed, 14 Oct 2026 15:37:01 +0800 Subject: [PATCH] feat: check artifact size when rendering thumbnails instead of silent enlarge --- src/assemblicon/lowlevel/artrdr.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/assemblicon/lowlevel/artrdr.py b/src/assemblicon/lowlevel/artrdr.py index 0dfe6cb..d77160a 100644 --- a/src/assemblicon/lowlevel/artrdr.py +++ b/src/assemblicon/lowlevel/artrdr.py @@ -182,11 +182,11 @@ def render_thumbnail(art: Artifact, hws: Iterable[int]) -> Iterator[Artifact]: # check whether given artifact is square rectangle. if art.width != art.height: - raise ValueError(f'Thumbnail render only accept square rectangle.') - # scale artifact up to the maximum resolution hws if it is too small. + raise ValueError('Thumbnail render only accept square rectangle.') + # check whether given artifact is larger than the maximum resolution hws. max_hws = max(hws) if art.width < max_hws: - art = art.resize((max_hws, max_hws), PIL.Image.Resampling.LANCZOS) + raise ValueError('Given artifact is too small for rendering thumbnail.') # render thumbnail for hw in hws: