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] <support@github.com>
This commit is contained in:
dependabot[bot]
2026-06-16 14:45:34 +00:00
committed by GitHub
parent 57d1cbc739
commit fd8948575a
6 changed files with 25 additions and 8 deletions

2
go.mod
View File

@@ -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

4
go.sum
View File

@@ -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=

View File

@@ -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.

View File

@@ -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)

View File

@@ -5,7 +5,7 @@ import os
import subprocess
VERSION = "1.8.20"
VERSION = "1.8.21"
def run(*args: str):

4
vendor/modules.txt vendored
View File

@@ -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