Skip to content

encode.webgpu.Function.findTextureMinMax

github-actions[bot] edited this page Oct 19, 2026 · 1 revision

@monogrid/gainmap-js / encode/webgpu / findTextureMinMax

Function: findTextureMinMax()

findTextureMinMax(image, mode, renderer, size?): Promise<[number, number, number]>

Defined in: src/encode/webgpu/find-texture-min-max.ts:49

Finds the min or max value of each RGB channel of an HDR image, on the GPU.

The image is reduced by 2x2 cells until it's 1x1, then the single remaining pixel is read back. Negative values are ignored when looking for the max, values above 65504 (max half float) when looking for the min.

Parameters

image

DataTextureLoaderTexData | HDRInput

the HDR image: a texture, raw texture data or a TSL node (which requires size)

mode

"min" | "max"

renderer

WebGPURenderer

size?

size of the image, required when the image is a generic node

height

number

width

number

Returns

Promise<[number, number, number]>

Example

import { findTextureMinMax } from '@monogrid/gainmap-js/encode/webgpu'

const [r, g, b] = await findTextureMinMax(exrTexture, 'max', renderer)
const maxContentBoost = Math.max(r, g, b)

Throws

if the image is a generic node and size is not provided

Clone this wiki locally