Nuestros voluntarios aún no han traducido este artículo al Español. ¡Únete a nosotros y ayuda a traducirlo!
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
ImageDataobject from a givenUint8ClampedArrayand 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 ascreateImageData()is not available there.
Properties
ImageData.dataRead only- Is a
Uint8ClampedArrayrepresenting a one-dimensional array containing the data in the RGBA order, with integer values between0and255(included). ImageData.heightRead only- Is an
unsignedlongrepresenting the actual height, in pixels, of theImageData. ImageData.widthRead only- Is an
unsignedlongrepresenting the actual width, in pixels, of theImageData.
Specifications
| Specification | Status | Comment |
|---|---|---|
| WHATWG HTML Living Standard The definition of 'ImageData' in that specification. |
Living Standard |
Browser compatibility
| Feature | Chrome | Firefox (Gecko) | Internet Explorer | Opera | Safari |
|---|---|---|---|---|---|
| Basic support | 4.0 | 14 (14) | 9.0 | 9.0 | 3.1 |
| Support in workers | ? | 25 (25) | ? | ? | ? |
ImageData() constructor |
? | 29 (29) | Not supported | ? | ? |
| Feature | Android | Firefox Mobile (Gecko) | IE Mobile | Opera Mobile | Safari Mobile |
|---|---|---|---|---|---|
| Basic support | 2.1 | 14.0 (14) | ? | 10.0 | 3.2 |
| Support in workers | ? | 25.0 (25) | ? | ? | ? |
ImageData() constructor |
? | 29.0 (29) | ? | ? | ? |
See also
CanvasRenderingContext2D- The
<canvas>element and its associated interface,HTMLCanvasElement.