Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix empty preview image #2101

Merged
merged 1 commit into from
Aug 15, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions backend/src/nodes/properties/outputs/numpy_outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from ...impl.image_utils import normalize, to_uint8
from ...impl.pil_utils import InterpolationMethod, resize
from ...utils.format import format_image_with_channels
from ...utils.utils import get_h_w_c
from ...utils.utils import get_h_w_c, round_half_up


class NumPyOutput(BaseOutput):
Expand Down Expand Up @@ -129,7 +129,7 @@ def preview_encode(
max_size = target_size * grace
if w > max_size or h > max_size:
f = max(w / target_size, h / target_size)
t = (int(w / f), int(h / f))
t = (max(1, round_half_up(w / f)), max(1, round_half_up(h / f)))
if c == 4:
# https://github.com/chaiNNer-org/chaiNNer/issues/1321
img = resize(img, t, InterpolationMethod.BOX)
Expand Down