Skip to content

Conversation

@Kebolder
Copy link

@Kebolder Kebolder commented Dec 9, 2025

Simple node that takes in a Width and Height as input. rescales Kritas canvas's size.

Node sends a small command with new size payload to Krita when ran and connected.

image

@Kebolder
Copy link
Author

Updated to use the krita output as the resizer now.

krita.py Outdated
inputs=[io.Image.Input("images")],
inputs=[
io.Image.Input("images"),
io.Int.Input("width", default=0, min=0, optional=True),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's more convenient to use only a toggle (resize on/off), since the width/height are already part of the image. Unless you see a scenario where they don't match?

krita.py Outdated

# Optionally attach a Krita canvas resize command so the client can
# resize the document together with applying the output.
if isinstance(width, int) and isinstance(height, int) and width > 0 and height > 0:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels like a lot of code, can it just be

def execute(cls, images: torch.Tensor, resize=False):
    result = SendImageWebSocket.execute(images, "PNG")
    result.ui["resize_canvas"] = resize
    return result

I don't really see a good reason to convert it into a special text message in the first place

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants