---
title: createImageData
framework: webkitjs
role: symbol
role_heading: Instance Method
path: webkitjs/canvasrenderingcontext2d/1632980-createimagedata
---

# createImageData

Creates an opaque object whose data property contains a one-dimensional array of pixel values, initialized to transparent black.

## Declaration

```data
ImageData createImageData(
    ImageData? imagedata
);
```

## Parameters

- `sw`: The width of the pixel array.
- `sh`: The height of the pixel array.

## Return Value

Return Value An imageData object.

## Discussion

Discussion This method is typically used to create additional pixel arrays that can be blitted to the canvas in a single operation. You can optionally pass in another imageData object as a parameter, instead of a width and height, to create a new imageData object with the same pixel dimensions as the specified object.

## See Also

### Manipulating Pixels

- [getImageData](webkitjs/canvasrenderingcontext2d/1632656-getimagedata.md)
- [putImageData](webkitjs/canvasrenderingcontext2d/1633082-putimagedata.md)
