While looking at ways to generate different image sizes as a dictionary that Hugo templates and Fuse JS can digest for search via a JSON file, chatGPT suggested the following partial.
{{- $images := dict -}}
{{- with or (.Resources.GetMatch "featured.*") (resources.GetMatch "fallback.*") }}
{{- $s := .Process "fill 350x350 webp TopLeft" }}
{{- $m:= .Process "fill 480x480 webp TopLeft" }}
{{- $l := .Process "fill 628x628 webp TopLeft" }}
{{- $images = dict
"s" (dict "src" $s.Permalink "w" $s.Width "h" $s.Height "type" $s.MediaType.Type)
"m" (dict "src" $m.Permalink "w" $m.Width "h" $m.Height "type" $m.MediaType.Type)
"l" (dict "src" $l.Permalink "w" $l.Width "h" $l.Height "type" $l.MediaType.Type)
-}}
{{- end }}
{{- return $images -}}
Then calling the partial in another partial or layout as such–
{{/* call your partial and store the returned dict */}}
{{- $images := partial "thumbnails.html" . -}}
{{ with $images }}
<picture>
<source srcset="{{ .s.src }}" media="(min-width: 1024px)" type="{{ .s.type }}">
<source srcset="{{ .m.src }}" media="(min-width:640px)" type="{{ .m.type }}">
<img src="{{ .l.src }}" width="{{ .l.w }}" height="{{ .l.h }}" alt="{{ $.Title }}" alt="">
</picture>
{{ end }}