From fd8948575a4e4e49f9e3a0b34675fdd885e7d9e4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 16 Jun 2026 14:45:34 +0000 Subject: [PATCH] build(deps): bump github.com/kovidgoyal/imaging from 1.8.20 to 1.8.21 Bumps [github.com/kovidgoyal/imaging](https://github.com/kovidgoyal/imaging) from 1.8.20 to 1.8.21. - [Release notes](https://github.com/kovidgoyal/imaging/releases) - [Commits](https://github.com/kovidgoyal/imaging/compare/v1.8.20...v1.8.21) --- updated-dependencies: - dependency-name: github.com/kovidgoyal/imaging dependency-version: 1.8.21 dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] --- go.mod | 2 +- go.sum | 4 ++-- .../github.com/kovidgoyal/imaging/README.md | 2 +- .../kovidgoyal/imaging/colorconv/colorconv.go | 19 ++++++++++++++++++- .../github.com/kovidgoyal/imaging/publish.py | 2 +- vendor/modules.txt | 4 ++-- 6 files changed, 25 insertions(+), 8 deletions(-) diff --git a/go.mod b/go.mod index 1bf3da9076..19762194b9 100644 --- a/go.mod +++ b/go.mod @@ -49,7 +49,7 @@ require ( github.com/jellydator/ttlcache/v3 v3.4.0 github.com/jinzhu/now v1.1.5 github.com/justinas/alice v1.2.0 - github.com/kovidgoyal/imaging v1.8.20 + github.com/kovidgoyal/imaging v1.8.21 github.com/leonelquinteros/gotext v1.7.3-0.20260422134830-b012b4ccae69 github.com/libregraph/idm v0.5.0 github.com/libregraph/lico v0.66.0 diff --git a/go.sum b/go.sum index 9bcab8c86a..79d53b28fb 100644 --- a/go.sum +++ b/go.sum @@ -737,8 +737,8 @@ github.com/kovidgoyal/go-parallel v1.1.1 h1:1OzpNjtrUkBPq3UaqrnvOoB2F9RttSt811ui github.com/kovidgoyal/go-parallel v1.1.1/go.mod h1:BJNIbe6+hxyFWv7n6oEDPj3PA5qSw5OCtf0hcVxWJiw= github.com/kovidgoyal/go-shm v1.0.0 h1:HJEel9D1F9YhULvClEHJLawoRSj/1u/EDV7MJbBPgQo= github.com/kovidgoyal/go-shm v1.0.0/go.mod h1:Yzb80Xf9L3kaoB2RGok9hHwMIt7Oif61kT6t3+VnZds= -github.com/kovidgoyal/imaging v1.8.20 h1:74GZ7C2rIm3rqmGEjK1GvvPOOnJ0SS5iDOa6Flfo0b0= -github.com/kovidgoyal/imaging v1.8.20/go.mod h1:d3phGYkTChGYkY4y++IjpHgUGhWGELDc2NEQAqxwZZg= +github.com/kovidgoyal/imaging v1.8.21 h1:95S2+dowTeKJJHNpf6lnScvIennTr2H0zQotu+ptNQw= +github.com/kovidgoyal/imaging v1.8.21/go.mod h1:976F+zjiQeZ7sd87Pxlm0a64S/w9bImSIWg3sSk1rdQ= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= diff --git a/vendor/github.com/kovidgoyal/imaging/README.md b/vendor/github.com/kovidgoyal/imaging/README.md index 34328a6e07..8c21ff980e 100644 --- a/vendor/github.com/kovidgoyal/imaging/README.md +++ b/vendor/github.com/kovidgoyal/imaging/README.md @@ -151,6 +151,6 @@ Original image | Hue = 60 ## Acknowledgements -This is a fork of the un-maintained distraction/imaging project. The color +This is a fork of the un-maintained disintegration/imaging project. The color management code was started out from mandykoh/prism and used some code from go-andiamo/iccarus but it was almost completely re-written from scratch. diff --git a/vendor/github.com/kovidgoyal/imaging/colorconv/colorconv.go b/vendor/github.com/kovidgoyal/imaging/colorconv/colorconv.go index a925676056..3aa3e7b14e 100644 --- a/vendor/github.com/kovidgoyal/imaging/colorconv/colorconv.go +++ b/vendor/github.com/kovidgoyal/imaging/colorconv/colorconv.go @@ -38,6 +38,8 @@ type ConvertColor struct { // Precomputed combined matrix from XYZ(whitepoint) directly to linear sRGB (D65). // Combined = srgbFromXYZ * adaptMatrix (where adaptMatrix adapts XYZ D50 -> XYZ D65). combined_XYZ_to_linear_SRGB Mat3 + previous_matrices Mat3 + out_of_gamut_handler *ConvertColor } func (c ConvertColor) String() string { @@ -47,6 +49,7 @@ func (c ConvertColor) String() string { func (cc *ConvertColor) AddPreviousMatrix(a, b, c [3]float64) { prev := Mat3{a, b, c} cc.combined_XYZ_to_linear_SRGB = mulMat3(cc.combined_XYZ_to_linear_SRGB, prev) + cc.previous_matrices = mulMat3(cc.previous_matrices, prev) } func NewConvertColor(whitepoint_x, whitepoint_y, whitepoint_z, scale float64) (ans *ConvertColor) { @@ -59,6 +62,10 @@ func NewConvertColor(whitepoint_x, whitepoint_y, whitepoint_z, scale float64) (a {0.0557 * scale, -0.2040 * scale, 1.0570 * scale}, } ans.combined_XYZ_to_linear_SRGB = mulMat3(srgbFromXYZ, adapt) + ans.previous_matrices[0][0] = 1 + ans.previous_matrices[1][1] = 1 + ans.previous_matrices[2][2] = 1 + ans.out_of_gamut_handler = &ConvertColor{whitepoint: ans.whitepoint, combined_XYZ_to_linear_SRGB: ans.combined_XYZ_to_linear_SRGB} return } @@ -148,6 +155,14 @@ func (c *ConvertColor) XYZToSRGB(X, Y, Z float64) (r, g, b float64) { if inGamut(r, g, b) { return } + // When only slightly out of gamut clamp for performance instead of doing actual mapping + const lower = -0.001 + const upper = 1 - lower + if r >= lower && r <= upper && g >= lower && g <= upper && b >= lower && b <= upper { + return clamp01(r), clamp01(g), clamp01(b) + } + X, Y, Z = mulMat3Vec(c.previous_matrices, Vec3{X, Y, Z}) + c = c.out_of_gamut_handler L, a, bb := c.XYZToLab(X, Y, Z) return c.LabToSRGB(L, a, bb) } @@ -384,6 +399,7 @@ func (c *ConvertColor) gamutMapChromaScale(L, a, b float64) (r, g, bl float64) { hi := 1.0 var mid float64 var foundR, foundG, foundB float64 + found := false // If even fully desaturated (a=b=0) is out of gamut, we'll clip for range 24 { mid = (lo + hi) / 2.0 @@ -392,6 +408,7 @@ func (c *ConvertColor) gamutMapChromaScale(L, a, b float64) (r, g, bl float64) { r0, g0, b0 := c.LabToSRGBNoGamutMap(L, a2, b2) if inGamut(r0, g0, b0) { foundR, foundG, foundB = r0, g0, b0 + found = true // can try to keep more chroma lo = mid } else { @@ -399,7 +416,7 @@ func (c *ConvertColor) gamutMapChromaScale(L, a, b float64) (r, g, bl float64) { } } // If we never found a valid in-gamut during binary search, try a= b =0 - if !(inGamut(foundR, foundG, foundB)) { + if !(found && inGamut(foundR, foundG, foundB)) { r0, g0, b0 := c.LabToSRGBNoGamutMap(L, 0, 0) // if still out-of-gamut (very unlikely), clip return clamp01(r0), clamp01(g0), clamp01(b0) diff --git a/vendor/github.com/kovidgoyal/imaging/publish.py b/vendor/github.com/kovidgoyal/imaging/publish.py index 624d1181da..9cc5a088e3 100644 --- a/vendor/github.com/kovidgoyal/imaging/publish.py +++ b/vendor/github.com/kovidgoyal/imaging/publish.py @@ -5,7 +5,7 @@ import os import subprocess -VERSION = "1.8.20" +VERSION = "1.8.21" def run(*args: str): diff --git a/vendor/modules.txt b/vendor/modules.txt index 2c2b5743e6..ae2d15d44c 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -875,8 +875,8 @@ github.com/kovidgoyal/go-parallel # github.com/kovidgoyal/go-shm v1.0.0 ## explicit; go 1.24.0 github.com/kovidgoyal/go-shm -# github.com/kovidgoyal/imaging v1.8.20 -## explicit; go 1.24.0 +# github.com/kovidgoyal/imaging v1.8.21 +## explicit; go 1.25.0 github.com/kovidgoyal/imaging github.com/kovidgoyal/imaging/apng github.com/kovidgoyal/imaging/colorconv