---
title: "ICanvasRenderingContext2D.CreateImageData"
url: "https://reference.aspose.com/html/net/aspose.html.dom.canvas/icanvasrenderingcontext2d/createimagedata/"
product: "Aspose.HTML for .NET API Reference"
description: "ICanvasRenderingContext2D CreateImageData method. Creates a new blank ImageData object with the specified dimensions. All of the pixels in the new object are transparent black"
---

## CreateImageData(*double, double*) {#createimagedata_1}

Creates a new, blank ImageData object with the specified dimensions. All of the pixels in the new object are transparent black.

```csharp
public IImageData CreateImageData(double sw, double sh)
```

| Parameter | Type | Description |
| --- | --- | --- |
| sw | Double | The width to give the new ImageData object. |
| sh | Double | The height to give the new ImageData object. |

### Return Value

A new ImageData object with the specified width and height. The new object is filled with transparent black pixels.

### See Also

* interface [IImageData](../../iimagedata/)
* interface [ICanvasRenderingContext2D](../)
* namespace [Aspose.Html.Dom.Canvas](../../../aspose.html.dom.canvas/)
* assembly [Aspose.HTML](../../../)

---

## CreateImageData(*[IImageData](../../iimagedata/)*) {#createimagedata}

Creates a new, blank ImageData object with the specified dimensions. All of the pixels in the new object are transparent black.

```csharp
public IImageData CreateImageData(IImageData imagedata)
```

| Parameter | Type | Description |
| --- | --- | --- |
| imagedata | IImageData | An existing ImageData object from which to copy the width and height. The image itself is not copied. |

### Return Value

A new ImageData object with the specified width and height. The new object is filled with transparent black pixels.

### See Also

* interface [IImageData](../../iimagedata/)
* interface [ICanvasRenderingContext2D](../)
* namespace [Aspose.Html.Dom.Canvas](../../../aspose.html.dom.canvas/)
* assembly [Aspose.HTML](../../../)
