# GrapeCity.Documents.Imaging.GcBitmap.CreateImage

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Imaging_GcBitmap_CreateImage_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.CreateImage*">CreateImage Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Imaging_GcBitmap_CreateImage_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.CreateImage*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap_CreateImage_System_Int32_System_Int32_System_Boolean_System_Single_System_Single_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.CreateImage(System.Int32,System.Int32,System.Boolean,System.Single,System.Single)">CreateImage(int, int, bool, float, float)</h4>
<div class="markdown level1 summary"><p>Creates the image of the given size and resolution.</p>
<p>The content is not initialized and can contain any random data.</p>
<p>If subsequent rendering is going to cover the whole surface of the
bitmap, or if <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.CreateGraphics.html#GrapeCity_Documents_Imaging_GcBitmap_CreateGraphics_System_Nullable_System_Drawing_Color__">CreateGraphics(Color?)</a> will be called on the bitmap with a non-null
background color, clearing it (which is a lengthy operation for large bitmaps) is not
needed. If some areas of the bitmap are going to be left untouched, they
must be cleared to avoid the possibility of random artifacts showing.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void CreateImage(int pixelWidth, int pixelHeight, bool opaque, float dpiX = 96, float dpiY = 96)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub CreateImage(pixelWidth As Integer, pixelHeight As Integer, opaque As Boolean, Optional dpiX As Single = 96, Optional dpiY As Single = 96)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pixelWidth</span></td>
      <td><p>The width of the image, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pixelHeight</span></td>
      <td><p>The height of the image, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">opaque</span></td>
      <td><p>Indicates if the alpha channel should be ignored.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">dpiX</span></td>
      <td><p>The horizontal dpi of the image.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">dpiY</span></td>
      <td><p>The vertical dpi of the image.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_GcBitmap_CreateImage_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.CreateImage*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap_CreateImage_System_UInt32___System_Int32_System_Int32_System_Boolean_System_Boolean_System_Single_System_Single_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.CreateImage(System.UInt32[],System.Int32,System.Int32,System.Boolean,System.Boolean,System.Single,System.Single)">CreateImage(uint[], int, int, bool, bool, float, float)</h4>
<div class="markdown level1 summary"><p>Creates the image based on the existing pixel data to be read/modified in-place.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void CreateImage(uint[] pixelData, int pixelWidth, int pixelHeight, bool opaque, bool premultiplied = false, float dpiX = 96, float dpiY = 96)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub CreateImage(pixelData As UInteger(), pixelWidth As Integer, pixelHeight As Integer, opaque As Boolean, Optional premultiplied As Boolean = False, Optional dpiX As Single = 96, Optional dpiY As Single = 96)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.uint32">uint</a>[]</td>
      <td><span class="parametername">pixelData</span></td>
      <td><p>The pixel data to be attached to a <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pixelWidth</span></td>
      <td><p>The width of the image, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pixelHeight</span></td>
      <td><p>The height of the image, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">opaque</span></td>
      <td><p>Indicates if the alpha channel should be ignored.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">premultiplied</span></td>
      <td><p>Indicates if the color channels are premultiplied by the alpha channel.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">dpiX</span></td>
      <td><p>The horizontal dpi of the image.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">dpiY</span></td>
      <td><p>The vertical dpi of the image.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_GcBitmap_CreateImage_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.CreateImage*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap_CreateImage_System_IntPtr_System_Int32_System_Int32_System_Boolean_System_Boolean_System_Single_System_Single_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.CreateImage(System.IntPtr,System.Int32,System.Int32,System.Boolean,System.Boolean,System.Single,System.Single)">CreateImage(IntPtr, int, int, bool, bool, float, float)</h4>
<div class="markdown level1 summary"><p>Creates the image based on the existing pixel data to be read/modified in-place.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public void CreateImage(IntPtr pixelData, int pixelWidth, int pixelHeight, bool opaque, bool premultiplied = false, float dpiX = 96, float dpiY = 96)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub CreateImage(pixelData As IntPtr, pixelWidth As Integer, pixelHeight As Integer, opaque As Boolean, Optional premultiplied As Boolean = False, Optional dpiX As Single = 96, Optional dpiY As Single = 96)</code></pre>
</div>
<h5 class="parameters">Parameters</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</th>
      <th>Name</th>
      <th>Description</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.intptr">IntPtr</a></td>
      <td><span class="parametername">pixelData</span></td>
      <td><p>The pixel data to be attached to a <a class="xref" href="GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a>.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pixelWidth</span></td>
      <td><p>The width of the image, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">pixelHeight</span></td>
      <td><p>The height of the image, in pixels.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">opaque</span></td>
      <td><p>Indicates if the alpha channel should be ignored.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">premultiplied</span></td>
      <td><p>Indicates if the color channels are premultiplied by the alpha channel.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">dpiX</span></td>
      <td><p>The horizontal dpi of the image.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.single">float</a></td>
      <td><span class="parametername">dpiY</span></td>
      <td><p>The vertical dpi of the image.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
