Skip to content
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.Opacity filter #11476

Merged
merged 1 commit into from
Sep 22, 2023
Merged

Add images.Opacity filter #11476

merged 1 commit into from
Sep 22, 2023

Conversation

bep
Copy link
Member

@bep bep commented Sep 21, 2023

Fixes #11471

@jmooring
Copy link
Member

jmooring commented Sep 21, 2023

This works great. At some point, processing without resizing will make it a bit easier.

This contrived example places a watermark over a base image, rotating it 90 degrees with 80% opacity.

{{ with $bi := resources.Get "images/base.jpg" }}
  {{ with resources.Get "images/overlay.jpg" }}
    {{ with .Resize (printf "%dx%d r90" .Height .Width) }}  <-- this is a hassle, have to reverse height & width
      {{ with .Filter images.Grayscale }}
        {{ with $bi.Filter (images.Overlay . 67 42) }}
          <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
        {{ end }}
      {{ end }}
    {{ end }}
  {{ end }}
{{ end }}

@bep bep force-pushed the feat/opacity-11471 branch from 52cfb30 to 47e85f7 Compare September 22, 2023 08:28
@bep bep mentioned this pull request Sep 22, 2023
@bep bep force-pushed the feat/opacity-11471 branch 2 times, most recently from 4ef4657 to e749020 Compare September 22, 2023 08:47
@bep bep force-pushed the feat/opacity-11471 branch from e749020 to a4cb3f9 Compare September 22, 2023 11:24
@bep bep merged commit f9b3c0f into gohugoio:master Sep 22, 2023
@jmooring jmooring mentioned this pull request Sep 23, 2023
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 23, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add images.Opacity filter
2 participants