images.Grayscale
返回一个生成图像灰度版本的图像滤镜。
用法
创建滤镜:
{{ $filter := images.Grayscale }}用 images.Filter 函数应用该滤镜:
{{ with resources.Get "images/original.jpg" }}
{{ with . | images.Filter $filter }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
{{ end }}
{{ end }}也可以在 Resource 对象上调用 Filter 方法应用该滤镜:
{{ with resources.Get "images/original.jpg" }}
{{ with .Filter $filter }}
<img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
{{ end }}
{{ end }}示例
英文原文此处用示例照片演示 Grayscale 滤镜的前后对比效果;本站未收录该示例图。