Nossos voluntários ainda não traduziram este artigo para o Português (do Brasil). Junte-se a nós e ajude-nos a fazer o trabalho!
Você também pode ler o artigo em English (US).

The ImageData interface represents the underlying pixel data of an area of a <canvas> element. It is created using the ImageData() constructor or creator methods on the CanvasRenderingContext2D object associated with a canvas: createImageData() and getImageData(). It can also be used to set a part of the canvas by using putImageData().

Constructors

ImageData()
Creates an ImageData object from a given Uint8ClampedArray and the size of the image it contains. If no array is given, it creates an image of a black rectangle. Note that this is the most common way to create such an object in workers as createImageData() is not available there.

Properties

ImageData.data Read only
Is a Uint8ClampedArray representing a one-dimensional array containing the data in the RGBA order, with integer values between 0 and 255 (included).
ImageData.height Read only
Is an unsigned long representing the actual height, in pixels, of the ImageData.
ImageData.width Read only
Is an unsigned long representing the actual width, in pixels, of the ImageData.

Specifications

Specification Status Comment
HTML Living Standard
The definition of 'ImageData' in that specification.
Living Standard  

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 4Edge Full support YesFirefox Full support 14IE Full support 9Opera Full support 9Safari Full support 3.1WebView Android Full support YesChrome Android Full support YesEdge Mobile ? Firefox Android Full support 14Opera Android Full support 10Safari iOS Full support 3.2Samsung Internet Android Full support Yes
Available in workersChrome Full support YesEdge ? Firefox Full support 25IE ? Opera ? Safari ? WebView Android Full support YesChrome Android ? Edge Mobile ? Firefox Android Full support 25Opera Android ? Safari iOS ? Samsung Internet Android ?
ImageData() constructor
Experimental
Chrome Full support 42Edge Full support YesFirefox Full support 29IE No support NoOpera Full support 29Safari ? WebView Android No support NoChrome Android Full support 42Edge Mobile ? Firefox Android Full support 29Opera Android ? Safari iOS ? Samsung Internet Android Full support 4.0
dataChrome Full support YesEdge Full support 12Firefox Full support 14IE Full support 9Opera Full support 9Safari Full support 3.1WebView Android ? Chrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 14Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
heightChrome Full support YesEdge Full support 12Firefox Full support 14IE Full support 9Opera Full support 9Safari Full support 3.1WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 14Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes
widthChrome Full support YesEdge Full support 12Firefox Full support 14IE Full support 9Opera Full support 9Safari Full support 3.1WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 14Opera Android Full support YesSafari iOS Full support YesSamsung Internet Android Full support Yes

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Experimental. Expect behavior to change in the future.
Experimental. Expect behavior to change in the future.

See also

Etiquetas do documento e colaboradores

Etiquetas: 
Última atualização por: Zhang-Junzhi,