diff --git a/resources/images/images_golden_integration_test.go b/resources/images/images_golden_integration_test.go index 49d90a79394..8c25c3f0c1f 100644 --- a/resources/images/images_golden_integration_test.go +++ b/resources/images/images_golden_integration_test.go @@ -69,8 +69,8 @@ func TestGoldenFiltersMisc(t *testing.T) { t.Skip("Skip golden test on this architecture") } - // Will be used to generate golden files. - name := "filters_misc" + // Will be used as the base folder for generated images. + name := "filters/misc" files := ` -- hugo.toml -- @@ -82,9 +82,9 @@ sourcefilename: ../testdata/sunset.jpg sourcefilename: ../testdata/gopher-hero8.png -- layouts/index.html -- Home. -{{ $sunset := resources.Get "sunset.jpg" }} +{{ $sunset := (resources.Get "sunset.jpg").Resize "x300" }} {{ $sunsetGrayscale := $sunset.Filter (images.Grayscale) }} -{{ $gopher := resources.Get "gopher.png" }} +{{ $gopher := (resources.Get "gopher.png").Resize "x80" }} {{ $overlayFilter := images.Overlay $gopher 20 20 }} {{ $textOpts := dict @@ -140,8 +140,8 @@ func TestGoldenFiltersMask(t *testing.T) { t.Skip("Skip golden test on this architecture") } - // Will be used to generate golden files. - name := "filters_mask" + // Will be used as the base folder for generated images. + name := "filters/mask" files := ` -- hugo.toml -- @@ -163,7 +163,12 @@ Home. {{ template "mask" (dict "name" "transparant.png" "base" $sunset "mask" $mask) }} {{ template "mask" (dict "name" "yellow.jpg" "base" $sunset "mask" $mask) }} {{ template "mask" (dict "name" "wide.jpg" "base" $sunset "mask" $mask "spec" "resize 600x200") }} - +{{/* This looks a little odd, but is correct and the recommended way to do this. +This will 1. Scale the image to x300, 2. Apply the mask, 3. Create the final image with background color #323ea. +It's possible to have multiple images.Process filters in the chain, but for the options for the final image (target format, bgGolor etc.), +the last entry will win. +*/}} +{{ template "mask" (dict "name" "blue.jpg" "base" $sunset "mask" $mask "spec" "resize x300 #323ea8") }} {{ define "mask"}} {{ $ext := path.Ext .name }} @@ -171,7 +176,7 @@ Home. {{ errorf "No extension in %q" .name }} {{ end }} {{ $format := strings.TrimPrefix "." $ext }} -{{ $spec := .spec | default (printf "resize 300x300 %s" $format) }} +{{ $spec := .spec | default (printf "resize x300 %s" $format) }} {{ $filters := slice (images.Process $spec) (images.Mask .mask) }} {{ $name := printf "images/%s" .name }} {{ $img := .base.Filter $filters }} @@ -191,8 +196,8 @@ func TestGoldenFiltersText(t *testing.T) { t.Skip("Skip golden test on this architecture") } - // Will be used to generate golden files. - name := "filters_text" + // Will be used as the base folder for generated images. + name := "filters/text" files := ` -- hugo.toml -- @@ -240,8 +245,8 @@ func TestGoldenProcessMisc(t *testing.T) { t.Skip("Skip golden test on this architecture") } - // Will be used to generate golden files. - name := "process_misc" + // Will be used as the base folder for generated images. + name := "process/misc" files := ` -- hugo.toml -- @@ -287,8 +292,8 @@ func TestGoldenFuncs(t *testing.T) { t.Skip("Skip golden test on this architecture") } - // Will be used to generate golden files. - name := "funcs" + // Will be used as the base folder for generated images. + name := "funcs/misc" files := ` -- hugo.toml -- @@ -324,7 +329,7 @@ func runGolden(t testing.TB, name, files string) *hugolib.IntegrationTestBuilder outputDir := filepath.Join(c.H.Conf.WorkingDir(), "public", "images") goldenBaseDir := filepath.Join("testdata", "images_golden") - goldenDir := filepath.Join(goldenBaseDir, name) + goldenDir := filepath.Join(goldenBaseDir, filepath.FromSlash(name)) if goldenOpts.writeGoldenFiles { c.Assert(htesting.IsRealCI(), qt.IsFalse) c.Assert(os.MkdirAll(goldenBaseDir, 0o777), qt.IsNil) diff --git a/resources/images/testdata/images_golden/filters/mask/blue.jpg b/resources/images/testdata/images_golden/filters/mask/blue.jpg new file mode 100644 index 00000000000..7c809774100 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/mask/blue.jpg differ diff --git a/resources/images/testdata/images_golden/filters/mask/transparant.png b/resources/images/testdata/images_golden/filters/mask/transparant.png new file mode 100644 index 00000000000..4d8c57ace5c Binary files /dev/null and b/resources/images/testdata/images_golden/filters/mask/transparant.png differ diff --git a/resources/images/testdata/images_golden/filters_mask/wide.jpg b/resources/images/testdata/images_golden/filters/mask/wide.jpg similarity index 100% rename from resources/images/testdata/images_golden/filters_mask/wide.jpg rename to resources/images/testdata/images_golden/filters/mask/wide.jpg diff --git a/resources/images/testdata/images_golden/filters/mask/yellow.jpg b/resources/images/testdata/images_golden/filters/mask/yellow.jpg new file mode 100644 index 00000000000..e7b3073db21 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/mask/yellow.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/brightness-40.jpg b/resources/images/testdata/images_golden/filters/misc/brightness-40.jpg new file mode 100644 index 00000000000..92d03e2f1d0 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/brightness-40.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/colorbalance-180-50-20.jpg b/resources/images/testdata/images_golden/filters/misc/colorbalance-180-50-20.jpg new file mode 100644 index 00000000000..1f34922eb23 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/colorbalance-180-50-20.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/contrast-50.jpg b/resources/images/testdata/images_golden/filters/misc/contrast-50.jpg new file mode 100644 index 00000000000..24a064338b1 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/contrast-50.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/dither-default.jpg b/resources/images/testdata/images_golden/filters/misc/dither-default.jpg new file mode 100644 index 00000000000..3960f94b2f7 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/dither-default.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/gamma-1.667.jpg b/resources/images/testdata/images_golden/filters/misc/gamma-1.667.jpg new file mode 100644 index 00000000000..e8fcbe75383 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/gamma-1.667.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/gaussianblur-5.jpg b/resources/images/testdata/images_golden/filters/misc/gaussianblur-5.jpg new file mode 100644 index 00000000000..36783bb6fd9 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/gaussianblur-5.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/grayscale+colorize-180-50-20.jpg b/resources/images/testdata/images_golden/filters/misc/grayscale+colorize-180-50-20.jpg new file mode 100644 index 00000000000..4902922b373 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/grayscale+colorize-180-50-20.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/grayscale.jpg b/resources/images/testdata/images_golden/filters/misc/grayscale.jpg new file mode 100644 index 00000000000..06617ee00be Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/grayscale.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/hue--15.jpg b/resources/images/testdata/images_golden/filters/misc/hue--15.jpg new file mode 100644 index 00000000000..68b191ec2de Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/hue--15.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/invert.jpg b/resources/images/testdata/images_golden/filters/misc/invert.jpg new file mode 100644 index 00000000000..69ab0fc1bfb Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/invert.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/opacity-0.65.jpg b/resources/images/testdata/images_golden/filters/misc/opacity-0.65.jpg new file mode 100644 index 00000000000..6da3c980e16 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/opacity-0.65.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/overlay-20-20.jpg b/resources/images/testdata/images_golden/filters/misc/overlay-20-20.jpg new file mode 100644 index 00000000000..3a6ca0b3035 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/overlay-20-20.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/padding-20-40-#976941.jpg b/resources/images/testdata/images_golden/filters/misc/padding-20-40-#976941.jpg new file mode 100644 index 00000000000..14a443f9aff Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/padding-20-40-#976941.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/pixelate-10.jpg b/resources/images/testdata/images_golden/filters/misc/pixelate-10.jpg new file mode 100644 index 00000000000..094de575e1b Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/pixelate-10.jpg differ diff --git a/resources/images/testdata/images_golden/filters_misc/rotate270.jpg b/resources/images/testdata/images_golden/filters/misc/rotate270.jpg similarity index 100% rename from resources/images/testdata/images_golden/filters_misc/rotate270.jpg rename to resources/images/testdata/images_golden/filters/misc/rotate270.jpg diff --git a/resources/images/testdata/images_golden/filters/misc/saturation-65.jpg b/resources/images/testdata/images_golden/filters/misc/saturation-65.jpg new file mode 100644 index 00000000000..d26585e6644 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/saturation-65.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/sepia-80.jpg b/resources/images/testdata/images_golden/filters/misc/sepia-80.jpg new file mode 100644 index 00000000000..76d08ad8cf8 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/sepia-80.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/sigmoid-0.6--4.jpg b/resources/images/testdata/images_golden/filters/misc/sigmoid-0.6--4.jpg new file mode 100644 index 00000000000..c6df067151c Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/sigmoid-0.6--4.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/text.jpg b/resources/images/testdata/images_golden/filters/misc/text.jpg new file mode 100644 index 00000000000..20e79dbad2d Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/text.jpg differ diff --git a/resources/images/testdata/images_golden/filters/misc/unsharpmask.jpg b/resources/images/testdata/images_golden/filters/misc/unsharpmask.jpg new file mode 100644 index 00000000000..9b04b670138 Binary files /dev/null and b/resources/images/testdata/images_golden/filters/misc/unsharpmask.jpg differ diff --git a/resources/images/testdata/images_golden/filters_text/text_alignx-center.jpg b/resources/images/testdata/images_golden/filters/text/text_alignx-center.jpg similarity index 100% rename from resources/images/testdata/images_golden/filters_text/text_alignx-center.jpg rename to resources/images/testdata/images_golden/filters/text/text_alignx-center.jpg diff --git a/resources/images/testdata/images_golden/filters_text/text_alignx-left.jpg b/resources/images/testdata/images_golden/filters/text/text_alignx-left.jpg similarity index 100% rename from resources/images/testdata/images_golden/filters_text/text_alignx-left.jpg rename to resources/images/testdata/images_golden/filters/text/text_alignx-left.jpg diff --git a/resources/images/testdata/images_golden/filters_text/text_alignx-right.jpg b/resources/images/testdata/images_golden/filters/text/text_alignx-right.jpg similarity index 100% rename from resources/images/testdata/images_golden/filters_text/text_alignx-right.jpg rename to resources/images/testdata/images_golden/filters/text/text_alignx-right.jpg diff --git a/resources/images/testdata/images_golden/filters_mask/transparant.png b/resources/images/testdata/images_golden/filters_mask/transparant.png deleted file mode 100644 index ffbd84c9636..00000000000 Binary files a/resources/images/testdata/images_golden/filters_mask/transparant.png and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_mask/yellow.jpg b/resources/images/testdata/images_golden/filters_mask/yellow.jpg deleted file mode 100644 index a87123536ea..00000000000 Binary files a/resources/images/testdata/images_golden/filters_mask/yellow.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/brightness-40.jpg b/resources/images/testdata/images_golden/filters_misc/brightness-40.jpg deleted file mode 100644 index a9aa6540bbe..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/brightness-40.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/colorbalance-180-50-20.jpg b/resources/images/testdata/images_golden/filters_misc/colorbalance-180-50-20.jpg deleted file mode 100644 index 875ec7acac4..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/colorbalance-180-50-20.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/contrast-50.jpg b/resources/images/testdata/images_golden/filters_misc/contrast-50.jpg deleted file mode 100644 index 3aeef7b8672..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/contrast-50.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/dither-default.jpg b/resources/images/testdata/images_golden/filters_misc/dither-default.jpg deleted file mode 100644 index f5a26a7b62f..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/dither-default.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/gamma-1.667.jpg b/resources/images/testdata/images_golden/filters_misc/gamma-1.667.jpg deleted file mode 100644 index 6998b8889f8..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/gamma-1.667.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/gaussianblur-5.jpg b/resources/images/testdata/images_golden/filters_misc/gaussianblur-5.jpg deleted file mode 100644 index c363f744433..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/gaussianblur-5.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/grayscale+colorize-180-50-20.jpg b/resources/images/testdata/images_golden/filters_misc/grayscale+colorize-180-50-20.jpg deleted file mode 100644 index 32b4616cf0c..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/grayscale+colorize-180-50-20.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/grayscale.jpg b/resources/images/testdata/images_golden/filters_misc/grayscale.jpg deleted file mode 100644 index 6db57fee516..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/grayscale.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/hue--15.jpg b/resources/images/testdata/images_golden/filters_misc/hue--15.jpg deleted file mode 100644 index 150cd007eb3..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/hue--15.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/invert.jpg b/resources/images/testdata/images_golden/filters_misc/invert.jpg deleted file mode 100644 index a2cf0cf8205..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/invert.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/opacity-0.65.jpg b/resources/images/testdata/images_golden/filters_misc/opacity-0.65.jpg deleted file mode 100644 index 1198857f6ac..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/opacity-0.65.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/overlay-20-20.jpg b/resources/images/testdata/images_golden/filters_misc/overlay-20-20.jpg deleted file mode 100644 index 1c8963f4286..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/overlay-20-20.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/padding-20-40-#976941.jpg b/resources/images/testdata/images_golden/filters_misc/padding-20-40-#976941.jpg deleted file mode 100644 index f0ac22de7e8..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/padding-20-40-#976941.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/pixelate-10.jpg b/resources/images/testdata/images_golden/filters_misc/pixelate-10.jpg deleted file mode 100644 index a181a73ec29..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/pixelate-10.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/saturation-65.jpg b/resources/images/testdata/images_golden/filters_misc/saturation-65.jpg deleted file mode 100644 index db33a7b25a7..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/saturation-65.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/sepia-80.jpg b/resources/images/testdata/images_golden/filters_misc/sepia-80.jpg deleted file mode 100644 index 8b79d34f99f..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/sepia-80.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/sigmoid-0.6--4.jpg b/resources/images/testdata/images_golden/filters_misc/sigmoid-0.6--4.jpg deleted file mode 100644 index 9dff50a22e4..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/sigmoid-0.6--4.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/text.jpg b/resources/images/testdata/images_golden/filters_misc/text.jpg deleted file mode 100644 index 1c3082bbe58..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/text.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/filters_misc/unsharpmask.jpg b/resources/images/testdata/images_golden/filters_misc/unsharpmask.jpg deleted file mode 100644 index 75164c3f6d9..00000000000 Binary files a/resources/images/testdata/images_golden/filters_misc/unsharpmask.jpg and /dev/null differ diff --git a/resources/images/testdata/images_golden/funcs/qr-default.png b/resources/images/testdata/images_golden/funcs/misc/qr-default.png similarity index 100% rename from resources/images/testdata/images_golden/funcs/qr-default.png rename to resources/images/testdata/images_golden/funcs/misc/qr-default.png diff --git a/resources/images/testdata/images_golden/funcs/qr-level-high_scale-6.png b/resources/images/testdata/images_golden/funcs/misc/qr-level-high_scale-6.png similarity index 100% rename from resources/images/testdata/images_golden/funcs/qr-level-high_scale-6.png rename to resources/images/testdata/images_golden/funcs/misc/qr-level-high_scale-6.png diff --git a/resources/images/testdata/images_golden/process_misc/crop-500x200-smart.jpg b/resources/images/testdata/images_golden/process/misc/crop-500x200-smart.jpg similarity index 100% rename from resources/images/testdata/images_golden/process_misc/crop-500x200-smart.jpg rename to resources/images/testdata/images_golden/process/misc/crop-500x200-smart.jpg diff --git a/resources/images/testdata/images_golden/process_misc/fill-500x200-smart.jpg b/resources/images/testdata/images_golden/process/misc/fill-500x200-smart.jpg similarity index 100% rename from resources/images/testdata/images_golden/process_misc/fill-500x200-smart.jpg rename to resources/images/testdata/images_golden/process/misc/fill-500x200-smart.jpg diff --git a/resources/images/testdata/images_golden/process_misc/fit-500x200-smart.jpg b/resources/images/testdata/images_golden/process/misc/fit-500x200-smart.jpg similarity index 100% rename from resources/images/testdata/images_golden/process_misc/fit-500x200-smart.jpg rename to resources/images/testdata/images_golden/process/misc/fit-500x200-smart.jpg diff --git a/resources/images/testdata/images_golden/process_misc/resize-100x100-gif.gif b/resources/images/testdata/images_golden/process/misc/resize-100x100-gif.gif similarity index 100% rename from resources/images/testdata/images_golden/process_misc/resize-100x100-gif.gif rename to resources/images/testdata/images_golden/process/misc/resize-100x100-gif.gif diff --git a/resources/images/testdata/images_golden/process_misc/resize-100x100-r180.png b/resources/images/testdata/images_golden/process/misc/resize-100x100-r180.png similarity index 100% rename from resources/images/testdata/images_golden/process_misc/resize-100x100-r180.png rename to resources/images/testdata/images_golden/process/misc/resize-100x100-r180.png diff --git a/resources/images/testdata/images_golden/process_misc/resize-300x300-jpg-b31280.jpg b/resources/images/testdata/images_golden/process/misc/resize-300x300-jpg-b31280.jpg similarity index 100% rename from resources/images/testdata/images_golden/process_misc/resize-300x300-jpg-b31280.jpg rename to resources/images/testdata/images_golden/process/misc/resize-300x300-jpg-b31280.jpg