Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Note: This feature is available in Web Workers.
The readonly ImageData.data property returns a Uint8ClampedArray or Float16Array that contains the ImageData object's pixel data. Data is stored as a one-dimensional array in the RGBA order.
The type depends on the ImageData.pixelFormat used:
This example creates an ImageData object that is 100 pixels wide and 100 pixels tall, making 10,000 pixels in all. The data array stores four values for each pixel, making 4 x 10,000, or 40,000 values in all.
If the ImageData object is set up for floating-point pixels — for example, for high dynamic range (HDR) images —data will be a Float16Array instead.
This example creates and fills a new ImageData object with colorful pixels.
Since each pixel consists of four values within the data array, the for loop iterates by multiples of four. The values associated with each pixel are R (red), G (green), B (blue), and A (alpha), in that order.
For more examples using ImageData.data, see Pixel manipulation with canvas, CanvasRenderingContext2D.createImageData(), and CanvasRenderingContext2D.putImageData().
| HTML # dom-imagedata-data |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Aug 19, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.