Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. ImageData
  4. pixelFormat

ImageData: pixelFormat property

Note: This feature is available inWeb Workers.

Experimental:This is anexperimental technology
Check theBrowser compatibility table carefully before using this in production.

The read-onlyImageData.pixelFormat property is a string indicating the pixel format of the image data.

The pixel format can be set duringImageData initialization using either theImageData() constructor or thecreateImageData() method.

Value

This property can have the following values:

  • "rgba-unorm8" representing RGBA with 8 bit per component unsigned normalized format, using aUint8ClampedArray.
  • "rgba-float16" representing RGBA with 16 bits per component, using aFloat16Array. Floating-point pixel values allow representing colors in arbitrarily wide gamuts and high dynamic range (HDR).

Examples

Floating-point pixel data for wide gamuts and high dynamic range (HDR)

Floating-point pixel values allow representing colors in arbitrarily wide gamuts and high dynamic range (HDR). You can set thepixelFormat setting to"rgba-float16" to use RGBA values with 16 bits per component. This requires thedataArray to be aFloat16Array.

js
let floatArray = new Float16Array(4 * 200 * 200);let imageData = new ImageData(floatArray, 200, 200, {  pixelFormat: "rgba-float16",});console.log(imageData.pixelFormat); // "rgba-float16"

Specifications

Specification
HTML
# dom-imagedata-pixelformat

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp