-
-
Notifications
You must be signed in to change notification settings - Fork 295
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
Crop to absolute size (with anchor) #2933
Comments
You can already achieve this technically, with math nodes and "edges" crop mode. Simply take the width and height of the image, subtract the target width and height, and then divide by 2. You will be left the amount you need to take off of each side to get a "center crop" |
I tried it this way ... but things get complicated because the edges could be horizontal or vertical, a lot of calculations and comparisons (unnecessary) In addition to this problem, if the number is not even we will have a difference of 1 pixel I don't see a simple solution with the current nodes. |
I don't understand the horizontal/vertical thing, if you're just doing a center crop it doesn't matter because it's even on either side. As for the uneven different, you'd need to either do a mod (modulo) operation to crop or pad to an even number, or just round the resulting values from the math. A dedicated node or crop mode for center cropping would have the same issue |
The difference of course is instead of a dedicated mode making that decision for you, you can decide how you want to do it. |
There is a "resize to side" node that can adaptively resize based on the image's dimensions. Not sure if that exactly fits your use case though |
"resize to side" node is not adaptive because it does not decide the side on which to resize. A crop with a fixed size would be convenient instead of thinking about the edges; I open a new issue with a similar but little different request |
@simolg If I understand this correctly, you basically want this, right? |
yes, cutting image with anchor it would be very convenient, similar to issue #777 it's also fun to use math, compare and conditional nodes :) |
Motivation
I have many images with multiple resolutions (therefore multiple aspect ratios),
I would like a function that cuts automatically these images to a fixed size.
Description
I don't know the initial aspect ratio of each images I can't calculate the every edges;
therefore the crop node will have to cut "automatically" to a "fixed" size
keeping each image centered (or other types of anchors)
generalizing:
on the contrary:
Alternatives
paint.net has a similar function (canvas size), which is very useful,
let's call it an "advanced automatic crop" ;)
The text was updated successfully, but these errors were encountered: