// original (first).
root *imageResource
- // These are only set for the root imageResource.
+ // These 2 are only set for the root imageResource.
exifInfoFn func() (*meta.ExifInfo, error)
metaInfoFn func() (*meta.MetaInfo, error)
})
img.setSourceFilenameIsHash(true)
img.setMediaType(conf.TargetFormat.MediaType())
+ img.Format = conf.TargetFormat
if err := img.InitConfig(r); err != nil {
return err
b.AssertFileContent("public/index.html", "Orientation: 6|eq 6: true|")
}
+func TestColorsIssue14453(t *testing.T) {
+ files := `
+-- hugo.toml --
+-- assets/sunset.jpg --
+sourcefilename: ../testdata/sunset.jpg
+-- layouts/home.html --
+{{ $img := resources.Get "sunset.jpg" }}
+{{ $img := $img.Fit "100x100" }}
+{{ $img := $img.Filter (slice images.AutoOrient (images.Process "fit 100x100 webp")) -}}
+{{ $colors := $img.Colors }}
+Colors: {{ $colors }}|
+`
+ tempDir := t.TempDir()
+ for range 2 {
+ b := hugolib.Test(t, files, hugolib.TestOptWithConfig(func(cfg *hugolib.IntegrationTestConfig) {
+ cfg.NeedsOsFS = true
+ cfg.WorkingDir = tempDir
+ }))
+ b.AssertFileContent("public/index.html", "Colors: [#2e2f34 #a39e94 #d39e57 #a96b3a #747b84 #7c838a]|")
+
+ }
+}
+
func BenchmarkImageResize(b *testing.B) {
files := `
-- content/p1/sunrise.jpg --