Brightness, saturation, and hue adjustment
These operations all change pixel appearance, but they are not interchangeable: brightness changes lightness, saturation changes colour intensity, and hue rotates a colour around the wheel. Each section covers one variant and pairs its image with the corresponding code.

Reference outputs were generated with govips v2.20.0 / libvips 8.17.3 in the locked Docker Runner. pyvips and the CLI do not provide a single-call saturation/hue modulation helper and are marked not-supported for those two variants. Image 0.72.0 calls Image.modulate/2 and has only had its metadata checked.
Brightness adjustment
Section titled “Brightness adjustment”govips.Modulate(1.25, 1, 0) raises brightness in LCh; sharp uses HSL semantics. The pyvips and CLI snippets use RGB linear multiplication as an approximation, not a pixel-equivalent implementation.


Generated with govips v2.20.0 / libvips 8.17.3.
image, err := vips.NewImageFromFile("input.jpg")if err != nil { return err }defer image.Close()if err := image.Modulate(1.25, 1, 0); err != nil { return err }data, _, err := image.ExportWebp(vips.NewWebpExportParams())if err != nil { return err }return os.WriteFile("brightness.webp", data, 0o644)await sharp('input.jpg').modulate({ brightness: 1.25 }).webp({ quality: 82 }).toFile('brightness.webp');image = pyvips.Image.new_from_file("input.jpg")bright = image.linear([1.25, 1.25, 1.25], [0, 0, 0])bright.write_to_file("brightness.webp", Q=82)vips linear input.jpg 'brightness.webp[Q=82]' 1.25 0Saturation adjustment
Section titled “Saturation adjustment”govips and sharp expose a direct Modulate / modulate entry point. Because pyvips and the CLI do not ship a single-step modulation helper, they are marked not-supported below rather than presenting an unmodified copy as a saturation transform.


Generated with govips v2.20.0 / libvips 8.17.3.
if err := image.Modulate(1, 0.35, 0); err != nil { return err }await sharp('input.jpg').modulate({ saturation: 0.35 }).webp({ quality: 82 }).toFile('saturation.webp');# pyvips has no single-call modulate helper; requires an LCh colourspace round-trip.# Marked not-supported for this variant.# The CLI has no single modulate command; requires chaining colourspace lch, linear, and colourspace srgb.# Marked not-supported for this variant.Hue adjustment
Section titled “Hue adjustment”Hue is an angular offset; 60 means a 60-degree rotation. govips performs Modulate in LCh, while sharp uses HSL/LCh modulation semantics, so equal numbers do not guarantee equal pixels.


Generated with govips v2.20.0 / libvips 8.17.3.
if err := image.Modulate(1, 1, 60); err != nil { return err }await sharp('input.jpg').modulate({ hue: 60 }).webp({ quality: 82 }).toFile('hue.webp');# Requires a manual sRGB → LCh → H-channel shift → sRGB round-trip; marked not-supported.# Requires chaining colourspace lch → hue channel shift → colourspace srgb; marked not-supported.Colour recombination (Recomb), inversion (Invert), and lookup tables (Maplut)
Section titled “Colour recombination (Recomb), inversion (Invert), and lookup tables (Maplut)”Beyond brightness, saturation, and hue, the four interfaces support three additional colour transforms:
- 3×3 colour recombination matrix (
Recomb/recomb): mixes R, G, and B channels through a 3×3 matrix for sepia toning, channel swapping, or colour-vision deficiency simulation. - Colour inversion (
Invert/negate/invert): maps 8-bit channels to255 - x(sharp.negate({ alpha: false })inverts RGB channels while leaving alpha untouched). - HSV modulation and 1D lookup tables (
ModulateHSV/Maplut):govipsalso providesimage.ModulateHSV(b, s, h)in HSV colour space andimage.Maplut(lut)(paired withvips.Identity(false)) for custom tone curves.
// 1. 3×3 sepia colour recombination matrixsepia := [][]float64{ {0.3588, 0.7044, 0.1368}, {0.2990, 0.5870, 0.1140}, {0.2392, 0.4696, 0.0912},}if err := image.Recomb(sepia); err != nil { return err}
// 2. Invert colour channelsif err := image.Invert(); err != nil { return err}// 1. 3×3 sepia colour recombination matrixawait sharp('input.jpg') .recomb([ [0.3588, 0.7044, 0.1368], [0.2990, 0.5870, 0.1140], [0.2392, 0.4696, 0.0912], ]) .webp({ quality: 82 }) .toFile('sepia.webp');
// 2. Invert RGB channels without inverting alphaawait sharp('input.jpg') .negate({ alpha: false }) .webp({ quality: 82 }) .toFile('inverted.webp');import pyvips
image = pyvips.Image.new_from_file("input.jpg")
# 1. 3×3 sepia colour recombination matrixmatrix = pyvips.Image.new_from_array([ [0.3588, 0.7044, 0.1368], [0.2990, 0.5870, 0.1140], [0.2392, 0.4696, 0.0912],])sepia = image.recomb(matrix).cast("uchar")
# 2. Invert colour channelsinverted = image.invert()# Invert colour channelsvips invert input.jpg 'inverted.webp[Q=82]'