Class

Uint16Image

Uint16ImageUint16Image(width, height, colorspaceopt)

Represents an image using a Uint16Array for its pixel data, providing support for high dynamic range (HDR) color spaces. Don't use this anymore, it's just here for migrating to Float16Array!

Constructor

# new Uint16Image(width, height, colorspaceopt)

Creates a new Uint16Image instance.

Parameters:
Name Type Attributes Description
width number

The width of the image in pixels.

height number

The height of the image in pixels.

colorspace string <optional>

The color space to use for the image. Defaults to DEFAULT_COLORSPACE.

View Source src/Uint16Image.ts, line 9

Classes

Uint16Image
Uint16Image
Uint16Image
Uint16Image

Members

# colorSpace

The color space of the image.

View Source src/Uint16Image.ts, line 13

HDRPredefinedColorSpace

# colorSpace

The color space of the image.

View Source src/Uint16Image.ts, line 188

# colorSpace

The color space of the image.

View Source src/Uint16Image.ts, line 13

HDRPredefinedColorSpace

# colorSpace

The color space of the image.

View Source src/Uint16Image.ts, line 188

# data

The raw pixel data stored as a Uint16Array.

View Source src/Uint16Image.ts, line 11

Uint16Array

# data

The raw pixel data stored as a Uint16Array.

View Source src/Uint16Image.ts, line 184

# data

The raw pixel data stored as a Uint16Array.

View Source src/Uint16Image.ts, line 11

Uint16Array

# data

The raw pixel data stored as a Uint16Array.

View Source src/Uint16Image.ts, line 184

Methods

# fill(color) → {Uint16Image|undefined}

Fills the entire image with a single color.

Parameters:
Name Type Description
color Array.<number>

An array of four numbers representing the R, G, B, and A channels (0-65535).

View Source src/Uint16Image.ts, line 206

The Uint16Image instance for method chaining, or undefined if the color array is invalid.

Uint16Image | undefined

# getImageData() → {ImageData|null}

Creates a standard ImageData object from the Uint16Image data.

View Source src/Uint16Image.ts, line 221

An ImageData object, or null if the data is undefined.

ImageData | null

# pixelCallback(fn)

Iterates through each pixel of the image and applies a callback function to its data.

Parameters:
Name Type Description
fn HDRImagePixelCallback

The callback function to apply to each pixel.

View Source src/Uint16Image.ts, line 246

# setImageData(imageData) → {void}

Sets the image data of the current Uint16Image instance.

Parameters:
Name Type Description
imageData HDRImageData

The image data to set.

View Source src/Uint16Image.ts, line 273

If the color space of the HDRImageData is not supported.

Error
void

# static convertArrayToRec2100_hlg(data) → {Uint16Array}

Converts a Uint8ClampedArray of sRGB pixel data to a Uint16Array of pixels in the rec2100-hlg color space.

Parameters:
Name Type Description
data Uint8ClampedArray

The array of 8-bit pixel data.

View Source src/Uint16Image.ts, line 239

The converted 16-bit pixel data.

Uint16Array

# static convertPixelToRec2100_hlg(pixel) → {Uint16Array}

Converts a single 8-bit pixel (from sRGB color space) to a 16-bit pixel in the rec2100-hlg color space.

Parameters:
Name Type Description
pixel Uint8ClampedArray

An array of four 8-bit numbers (R, G, B, A).

View Source src/Uint16Image.ts, line 230

The converted 16-bit pixel in the rec2100-hlg color space.

Uint16Array

# static fromImageData(imageData) → {Uint16Image}

Creates a Uint16Image instance from an HDRImageData object.

Parameters:
Name Type Description
imageData HDRImageData

The image data to use.

View Source src/Uint16Image.ts, line 255

If the color space of the HDRImageData is not supported.

Error

The new Uint16Image instance.

Uint16Image

# async static fromURL(url) → {Promise.<(Uint16Image|undefined)>}

Loads an image from a URL and creates a Uint16Image instance from it.

Parameters:
Name Type Description
url URL

The URL of the image to load.

View Source src/Uint16Image.ts, line 264

A promise that resolves with a Uint16Image instance, or undefined if the image could not be loaded.

Promise.<(Uint16Image|undefined)>

# static scaleUint8ToUint16(val) → {number}

Scales an 8-bit value to a 16-bit value. This is typically used for the alpha channel.

Parameters:
Name Type Description
val number

The 8-bit value to scale (0-255).

View Source src/Uint16Image.ts, line 214

The corresponding 16-bit value.

number

Uint16Image(width, height, colorspaceopt)

Represents an image using a Uint16Array for its pixel data, providing support for high dynamic range (HDR) color spaces. Don't use this anymore, it's just here for migrating to Float16Array!

Constructor

# new Uint16Image(width, height, colorspaceopt)

Creates a new Uint16Image instance.

Parameters:
Name Type Attributes Description
width number

The width of the image in pixels.

height number

The height of the image in pixels.

colorspace string <optional>

The color space to use for the image. Defaults to DEFAULT_COLORSPACE.

View Source src/Uint16Image.ts, line 9

Classes

Uint16Image
Uint16Image
Uint16Image
Uint16Image

Members

# colorSpace

The color space of the image.

View Source src/Uint16Image.ts, line 13

HDRPredefinedColorSpace

# colorSpace

The color space of the image.

View Source src/Uint16Image.ts, line 188

# colorSpace

The color space of the image.

View Source src/Uint16Image.ts, line 13

HDRPredefinedColorSpace

# colorSpace

The color space of the image.

View Source src/Uint16Image.ts, line 188

# data

The raw pixel data stored as a Uint16Array.

View Source src/Uint16Image.ts, line 11

Uint16Array

# data

The raw pixel data stored as a Uint16Array.

View Source src/Uint16Image.ts, line 184

# data

The raw pixel data stored as a Uint16Array.

View Source src/Uint16Image.ts, line 11

Uint16Array

# data

The raw pixel data stored as a Uint16Array.

View Source src/Uint16Image.ts, line 184

Methods

# fill(color) → {Uint16Image|undefined}

Fills the entire image with a single color.

Parameters:
Name Type Description
color Array.<number>

An array of four numbers representing the R, G, B, and A channels (0-65535).

View Source src/Uint16Image.ts, line 206

The Uint16Image instance for method chaining, or undefined if the color array is invalid.

Uint16Image | undefined

# getImageData() → {ImageData|null}

Creates a standard ImageData object from the Uint16Image data.

View Source src/Uint16Image.ts, line 221

An ImageData object, or null if the data is undefined.

ImageData | null

# pixelCallback(fn)

Iterates through each pixel of the image and applies a callback function to its data.

Parameters:
Name Type Description
fn HDRImagePixelCallback

The callback function to apply to each pixel.

View Source src/Uint16Image.ts, line 246

# setImageData(imageData) → {void}

Sets the image data of the current Uint16Image instance.

Parameters:
Name Type Description
imageData HDRImageData

The image data to set.

View Source src/Uint16Image.ts, line 273

If the color space of the HDRImageData is not supported.

Error
void

# static convertArrayToRec2100_hlg(data) → {Uint16Array}

Converts a Uint8ClampedArray of sRGB pixel data to a Uint16Array of pixels in the rec2100-hlg color space.

Parameters:
Name Type Description
data Uint8ClampedArray

The array of 8-bit pixel data.

View Source src/Uint16Image.ts, line 239

The converted 16-bit pixel data.

Uint16Array

# static convertPixelToRec2100_hlg(pixel) → {Uint16Array}

Converts a single 8-bit pixel (from sRGB color space) to a 16-bit pixel in the rec2100-hlg color space.

Parameters:
Name Type Description
pixel Uint8ClampedArray

An array of four 8-bit numbers (R, G, B, A).

View Source src/Uint16Image.ts, line 230

The converted 16-bit pixel in the rec2100-hlg color space.

Uint16Array

# static fromImageData(imageData) → {Uint16Image}

Creates a Uint16Image instance from an HDRImageData object.

Parameters:
Name Type Description
imageData HDRImageData

The image data to use.

View Source src/Uint16Image.ts, line 255

If the color space of the HDRImageData is not supported.

Error

The new Uint16Image instance.

Uint16Image

# async static fromURL(url) → {Promise.<(Uint16Image|undefined)>}

Loads an image from a URL and creates a Uint16Image instance from it.

Parameters:
Name Type Description
url URL

The URL of the image to load.

View Source src/Uint16Image.ts, line 264

A promise that resolves with a Uint16Image instance, or undefined if the image could not be loaded.

Promise.<(Uint16Image|undefined)>

# static scaleUint8ToUint16(val) → {number}

Scales an 8-bit value to a 16-bit value. This is typically used for the alpha channel.

Parameters:
Name Type Description
val number

The 8-bit value to scale (0-255).

View Source src/Uint16Image.ts, line 214

The corresponding 16-bit value.

number