ImageData
인터페이스는 <canvas>
엘리먼트 영역의 기저의 픽셀데이터를 나타냅니다ImageData()
생성자나 canvas객체에 연결된 CanvasRenderingContext2D
객체의 createImageData()
나 getImageData()
메소드로 생성할 수 있습니다. ImageData는 putImageData()
의 인자로 전달할 수 있으며, 이를 통해 canvas의 일부로 반영할 수 있습니다.
Constructors
ImageData()
- 인자로 주어진
Uint8ClampedArray
로 부터 해당 크기에 맞는 ImageData객체를 생성합니다. 만약 인자가 주어지지 않으면 검정색 사각형 이미지를 생성합니다.createImageData()
는 worker에서 사용할 수 없기 때문에, ImageData의 생성자를 이용하는 것이 가장 일반적인 방법입니다.
Properties
ImageData.data
Read onlyUint8ClampedArray
형식이며 1차원 배열로 RGBA순서로 정의된 이미지 데이터를 나타내니다. 각 원소는 정수값으로 0에서 255사이의 값을 갖습니다.ImageData.height
Read only- unsigned long형식으로 ImageData의 pixel기준의 실제 높이값입니다.
ImageData.width
Read only- unsigned long형식으로 ImageData의 pixel기준의 실제 가로값입니다.
Specifications
Specification | Status | Comment |
---|---|---|
HTML Living Standard The definition of 'ImageData' in that specification. |
Living Standard |
Browser compatibility
We're converting our compatibility data into a machine-readable JSON format.
This compatibility table still uses the old format,
because we haven't yet converted the data it contains.
Find out how you can help!
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) | No support | ? | ? |
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
.