images.Brightness
Syntax
images.Brightness 百分比
Returns
images.filter
百分比必须在[-100, 100]的范围内,其中0没有任何效果。-100的值产生纯黑色图像,100的值产生纯白色图像。
用法
创建图像滤镜:
{{ $filter := images.Brightness 12 }}
使用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 }}
示例
Original

Processed
