-
-
Notifications
You must be signed in to change notification settings - Fork 7.7k
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
Add images.Overlay filter #8057
Comments
What about |
Unfortunately it crops the image with Smartcrop. I will post all of the things I've tried for your reference: |
Sure, but that is an option -- you can put the anchor for the crop wherever you want. |
OK, I understand. I thought your main point was to get it ... square. If you don't want to crop it, why not use Fit and make it square in CSS (e.g. center it in a square div)? |
I am trying to generate a CSV Output Format with Hugo, so that it can be used by Facebook/Instagram to auto-update a product catalog. The square format product photo is a requirement. Oh well never mind... 🙄 I’ll just carry on running imageMagick to add the whitespace after generating a thumb with Hugo’s |
Thinking about this, I think this fits better in the
I'm not totally sure I got the order of the arguments right in the above, but the concept should be clear? It was discussed here #4595 |
I will add a PR with a new Overlay filter function that you can test out later today... I think it will work great and have lots of other use cases. |
As I understand it the For example in my use case something like:
Would do the job nicely. Looking forward to your Pull Request. I will test it as soon as possible. |
This allows for constructs ala: ``` {{ $overlay := $img.Filter ($logo | images.Overlay 50 50 )}} ``` Or: ``` {{ $logoFilter := ($logo | images.Overlay 50 50 ) }} {{ $overlay := $img | images.Filter $logoFilter }} ``` Which will overlay the logo in the top left corner (x=50, y=50) of `$img`. Fixes gohugoio#8057
This allows for constructs ala: ``` {{ $overlay := $img.Filter (images.Overlay $logo 50 50 )}} ``` Or: ``` {{ $logoFilter := (images.Overlay $logo 50 50 ) }} {{ $overlay := $img | images.Filter $logoFilter }} ``` Which will overlay the logo in the top left corner (x=50, y=50) of `$img`. Fixes gohugoio#8057
This allows for constructs ala: ``` {{ $overlay := $img.Filter (images.Overlay $logo 50 50 )}} ``` Or: ``` {{ $logoFilter := (images.Overlay $logo 50 50 ) }} {{ $overlay := $img | images.Filter $logoFilter }} ``` Which will overlay the logo in the top left corner (x=50, y=50) of `$img`. Fixes gohugoio#8057 Fixes gohugoio#4595 Updates gohugoio#6731
This allows for constructs ala: ``` {{ $overlay := $img.Filter (images.Overlay $logo 50 50 )}} ``` Or: ``` {{ $logoFilter := (images.Overlay $logo 50 50 ) }} {{ $overlay := $img | images.Filter $logoFilter }} ``` Which will overlay the logo in the top left corner (x=50, y=50) of `$img`. Fixes gohugoio#8057 Fixes gohugoio#4595 Updates gohugoio#6731
This allows for constructs ala: ``` {{ $overlay := $img.Filter (images.Overlay $logo 50 50 )}} ``` Or: ``` {{ $logoFilter := (images.Overlay $logo 50 50 ) }} {{ $overlay := $img | images.Filter $logoFilter }} ``` Which will overlay the logo in the top left corner (x=50, y=50) of `$img`. Fixes #8057 Fixes #4595 Updates #6731
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
A while back I opened this topic in the forum.
This is a missing feature that causes me grief again and again.
So I decided to post in the GitHub issues tracker hoping that perhaps someone someday might look into it.
Use case: Square product thumbnails need to be generated from portrait product photos.
Current situation: If one uses for example
{{- $thumb := ($original.Resize "1080x1080").RelPermalink }}
they will end up with a distorted image since.Resize
does exactly as told without any concept of respecting the aspect ratio. Similarly if one were to use{{- $thumb := ($original.Fit "1080x1080").RelPermalink }}
they would end up with an image that respects the original aspect ratio but is not square.I have sort of forgottenAs far as I can tell the library that Hugo uses for image processing is https://github.com/disintegration/imaging/ if you think that this issue does not belong here, let me know and I will open an issue upstream.The text was updated successfully, but these errors were encountered: