Canvas JavaScript

ImageData Class

ImageData Class
ConstructorsDescription
ImageData(w, h)This constructs an ImageData object with the width and height given by w and h.
ImageData(w, h, settings)This constructs an ImageData object with the width and height given by w and h. The settings parameter is a colorSpace object.
ImageData(dataArray, w)This constructs an ImageData object with the width given by w. The dataArray is a Uint8ClampedArray object containing the pixel representation.
ImageData(dataArray, w, h)This constructs an ImageData object with the width and height given by w and h. The dataArray is a Uint8ClampedArray object containing the pixel representation.
ImageData(dataArray, w, h, settings)This constructs an ImageData object with the width and height given by w and h.The dataArray is a Uint8ClampedArray object containing the pixel representation. The settings parameter is a colorSpace object.
PropertiesDescription
dataThis is an array of pixel data with values 0 to 255. The data for a given pixel is stored as a sequence of four values representing the red, green, blue, and alpha values. The pixels begin in the upper-left corner and advance left to right and down the image. So, the values 0, 1, 2 and 3 specify the red, green, blue and alpha values of the upper-left pixel and the values 4, 5, 6, and 8 specify the values of the pixel to the right of it.
colorSpaceThis defines color space of the pixel data. It can have the values srgb, representing the sRGB color space, or display-p3, representing the display-p3 color space.
heightThis defines the height of the ImageData in pixels.
widthThis defines the width of the ImageData in pixels.
 
 

© 2007–2025 XoaX.net LLC. All rights reserved.