Debian Codegraph @

docs/content/en/functions/images/Process.md

raw
1 ---
2 title: images.Process
3 description: Returns an image filter that processes an image according to the given processing specification.
4 categories: []
5 keywords: [process]
6 params:
7 functions_and_methods:
8 aliases: []
9 returnType: images.filter
10 signatures: [images.Process SPECIFICATION]
11 ---
12
13 Returns an image filter that processes an image according to the given [processing specification](#processing-specification). This versatile filter supports the full range of image transformations, including resizing, cropping, rotation, and format conversion, all within a single specification string. Use this as an argument to the [`Filter`][] method or the [`images.Filter`][] function.
14
15 ```go-html-template
16 {{ with resources.Get "images/original.jpg" }}
17 {{ $filter := images.Process "crop 200x200 TopRight webp q50" }}
18 {{ with .Filter $filter }}
19 <img src="{{ .RelPermalink }}" width="{{ .Width }}" height="{{ .Height }}" alt="">
20 {{ end }}
21 {{ end }}
22 ```
23
24 In the example above, `"crop 200x200 TopRight webp q50"` is the processing specification.
25
26 {{% include "/_common/methods/resource/processing-spec.md" %}}
27
28 ## Usage
29
30 Create a filter:
31
32 ```go-html-template
33 {{ $filter := images.Process "crop 200x200 TopRight webp q50" }}
34 ```
35
36 {{% include "/_common/functions/images/apply-image-filter.md" %}}
37
38 ## Example
39
40 {{< img
41 src="images/examples/zion-national-park.jpg"
42 alt="Zion National Park"
43 filter="Process"
44 filterArgs="crop 200x200 TopRight webp q50"
45 example=true
46 >}}
47
48 [`Filter`]: /methods/resource/filter/
49 [`images.Filter`]: /functions/images/filter/