-
Notifications
You must be signed in to change notification settings - Fork 344
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
Using v1, resize operation should preserve aspect ratio or it should resize to the set dimension? #93
Comments
Try passing |
So the ar thing ( |
You don't have to do manual crop calculation unless you explicitly want it. bimg crop calculus is based on a specific width, height or both. If you want to keep the aspect ratio, you should pass only Is that clear for you? Try running some transformation. |
My use case is that I want to use bimg to resize an image to fit in a box of 1024x1024, so if it's wider it would resize to something like 1024x800px and if it is taller to 800x1024px. |
Try using |
I'm wondering about this as well. I would like my image to "fit in" a given box. I don't want anything cropped, just resized, preserving the aspect ratio. Resize does what I want if I only pass one dimension, but I want to pass both width and height. Example: I have an image that is 100x200. I ask for it to "fit in" a box of 100x100. The image I get back should be 50x100. |
Looking at the code, looks like
body, err = img.Process(bimg.Options{ Width: 1000, Height: 1000 })
should actually resize the image to a size contained by the box, preserving aspect ratio, or I understood something wrong?It my case it actually resizes the image to the fixed 1000x1000px, is this the correct behavior and for the case described above I should do the calculations myself?
The text was updated successfully, but these errors were encountered: