Image.avatar/2 does not resize to either the default or specified size
Closed this issue · 6 comments
I'm pretty excited about replacing ImageMagick with Image, but right now I'm running into an issue with avatar!/2
and avatar/2
. In each case, I'm receiving seemingly randomly resized images from the original.
Example:
After running the following through, Image.avatar(i, [size: 300, shape: :square])
The resulting image is only 169px wide/high.
That isn't the only image I'm having troubles with. It does seem to come close to getting it right if I start with a square, but it still shaves off a few pixels in both directions.
I'm running the following;
- Elixir 1.15.4 OTP 26
- Image v0.39.1
Thanks for the report. And yes, definitely a bug. The source of the bug comes from the initial cropping of the source image which is cropping the longest edge to the :size
parameter. That works find when the source image is already square, but not so good for images like your example.
I've pushed a commit that forces a resize which I believe fixes this issue.
Would you consider configuring to run image
from GitHub and see if it now does what you expect? Just configure in mix.exs
as {:image, github: "kipcole9/image"}
.
Let me know and I'll publish an update to hex.
Ah, yes, I see that. Back to work on it.....
I think I've got it sorted now in the latest commit. Let me know if I got it right this time?
Nailed it. Thanks a ton
\m/ (>.<) \m/
I've published image 0.39.2 with the following changelog entry:
Bug Fix
- Fix
Image.avatar/2
to correctly resize and maintain aspect ratio. Thanks to @samullen for the report and patience. Closes #123.
Thanks again for the collaboration.