# images.Colorize
> 返回一个生成图像着色版本的图像滤镜。
- 官方英文原文：https://gohugo.io/functions/images/colorize/
- 本页规范地址：https://hugozh.cn/functions/images/colorize/
- 最近更新：2026-10-02
- 最后提交：912b1d3 chore(site): 添加 static/CNAME（hugozh.cn），供 GitHub Pages 等平台绑定自定义域名
- 签名：images.Colorize HUE SATURATION PERCENTAGE
- 返回类型：images.filter
- 站点：Hugo 中文文档（https://hugozh.cn/）· 社区维护的非官方中文翻译，如有出入以官方英文原文为准

---
色相是色轮上的角度，取值范围通常是 `[0, 360]`。

饱和度必须在 `[0, 100]` 区间内。

百分比指定效果的强度，必须在 `[0, 100]` 区间内。

## 用法

创建滤镜：

```go-html-template
{{ $filter := images.Colorize 180 50 20 }}
```

用 [`images.Filter`][] 函数应用该滤镜：

```go-html-template
{{ with resources.Get "images/original.jpg" }}
  {{ with . | images.Filter $filter }}
    <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
  {{ end }}
{{ end }}
```

也可以在 `Resource` 对象上调用 [`Filter`][] 方法应用该滤镜：

```go-html-template
{{ with resources.Get "images/original.jpg" }}
  {{ with .Filter $filter }}
    <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
  {{ end }}
{{ end }}
```

## 示例

英文原文此处用示例照片演示 `Colorize 180 50 20` 的前后对比效果；本站未收录该示例图。

[`Filter`]: /methods/resource/filter/
[`images.Filter`]: /functions/images/filter/

