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

Resize to side node #910

Merged
merged 13 commits into from
Sep 9, 2022

Conversation

BigBoyBarney
Copy link
Contributor

Added a new node that resizes an image while keeping aspect ratio. Resize targets are width, height, shorter side and longer side.
Previously this was only possible through the combination of 3 math nodes and a resize (factor) node

A new resize node that resizes an image to a desired target size on a given side while keeping aspect ratio
Added Size Preview to node.
Ran test with
> npm run test-js -- -U
and added the files.
Added a missing whitespace
@BigBoyBarney
Copy link
Contributor Author

Also this partially fulfils #798

Added a Resize Condition dropdown with options: Upscale And Downscale, Upscale Only, Downscale Only.
@BigBoyBarney
Copy link
Contributor Author

build checks fail after my recent "Resize Condition" push. It was fine before. Hmmm

@joeyballentine
Copy link
Member

Holy shit that's a large type definition... Maybe we should start putting these in their own files? @RunDevelopment would need to take care of that though. Maybe we can worry about that when we refactor how node files work.

Btw, there's a lot of repeated code in this. Consider extracting out the repeated stuff into their own methods.

@BigBoyBarney
Copy link
Contributor Author

BigBoyBarney commented Sep 8, 2022

The type definition can probably be shortened a bit by using a single struct Size { width: uint, height: uint } or similar instead of singular lets at the beginning. I don't think I can make the match cases any shorter tho.
^^Edit: nvm I already do this lol

Btw, there's a lot of repeated code in this. Consider extracting out the repeated stuff into their own methods.

You mean the python part? I can do that

Method is now called from utils.py and differentiates between upscale and downscale so there should be no redundant lines
@joeyballentine joeyballentine merged commit 29f9b67 into chaiNNer-org:main Sep 9, 2022
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.

None yet

2 participants