-
-
Notifications
You must be signed in to change notification settings - Fork 456
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
Nocrop with resize no longer working #161
Comments
Nothing relevant changed in |
@h2non I've had a look into this and think I've traced the regression in https://github.com/h2non/bimg/blob/master/resizer.go#L456 Currently it's factor = math.Min(xfactor, yfactor) Previously it was if o.Crop {
factor = math.Min(xfactor, yfactor)
} else {
factor = math.Max(xfactor, yfactor)
} If i revert this change then things seem to work again, but I get one failing test in I was going to open a PR but worried I'm not fully over this so could be introducing a different regression. Let me know if you want that PR, otherwise hopefully this is of some use. |
I would prefer maintaining the current behavior since it's more predictable and fits better in the majority of use cases. That being said, you can get similar outputs by playing with |
I have tested changing the "force" and "embed" parameters but that does not seem to solve this. I also tried the new "fit" operation which seemed like it might do a similar thing but that does not seem to help with padding out the image. |
@hnon There are definitely usecases where you are in the need of the returned image's dimension to fit what you requested for with and height and the aspect ratio is not changed I would call it inner fit with paddings added. Currently I'm also unable to get such a behavior on any endpoint as far as I can see Maybe a new endpoint would be an option? E.g., On the other hand I also thought that maybe embed / extend would offer something into that direction, but couldn't figure out how to get those working... |
Folks, feel free to investigate and provide a fix for this and I will review it asap. |
Hi @h2non I would be happy to provide a fix, or an evolution, I would just like to do it as it make the more sense on the both repository (that both belong to you if I'm correct :) ). For me, the change in bimg make the imaginary parameter extend useless (at least I was not able to find out how to replicate a similar behaviour, "the edges of an image are extended") I see several options here in order to get this behaviour back :
Main question for me is, as bimg aims to provide a wrapper around vips it make more sense for me to create a fix inside bimg in order to provide to every consumer the ability to use this behaviour (not only imaginary). Let me know if I should create an issue into bimg as this seems mostly related to a change done there, not inside the imaginary repository. Let me think what are your thoughts on that @mikestead @claws-se @h2non |
@luphaz Hi there
Me and @claws-se are sitting here and are in agreement that it would be a good idea to open the issue on bimg; but a fix that's local to imaginary would for our purposes just as fine! The biggest problem for us is that we can't upgrade to the latest and greatest. |
I've recently upgraded from Imaginary 1.0.7 and noticing that the
nocrop
option isn't working anymore when resizing. Testing via the official docker images this seems to have changed in v1.0.8To get the above results I'm starting the server like so
or
before running
https://localhost:9000/resize?width=200&height=200&nocrop=true&url=https://c1.staticflickr.com/1/409/18186063494_386acbe85c_k.jpg
The text was updated successfully, but these errors were encountered: