# GrapeCity.Documents.Imaging.Windows.GcWicBitmap.-ctor

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor*">GcWicBitmap Constructor
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor">GcWicBitmap()</h4>
<div class="markdown level1 summary"><p>Initializes an instance of the <a class="xref" href="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.html">GcWicBitmap</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcWicBitmap()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New()</code></pre>
</div>


<a id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_System_Int32_System_Int32_System_Boolean_System_Single_System_Single_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor(System.Int32,System.Int32,System.Boolean,System.Single,System.Single)">GcWicBitmap(int, int, bool, float, float)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.html">GcWicBitmap</a> class and creates the image.</p>
<p>The image content is not initialized and can contain any random data.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcWicBitmap(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 New(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 whether 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_Windows_GcWicBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_System_IO_Stream_System_Int32_System_Nullable_System_Drawing_Rectangle__" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor(System.IO.Stream,System.Int32,System.Nullable{System.Drawing.Rectangle})">GcWicBitmap(Stream, int, Rectangle?)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.html">GcWicBitmap</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcWicBitmap(Stream stream, int frameIndex = 0, Rectangle? imageRect = null)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(stream As Stream, Optional frameIndex As Integer = 0, Optional imageRect As Rectangle? = Nothing)</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.io.stream">Stream</a></td>
      <td><span class="parametername">stream</span></td>
      <td><p>The source stream. JPEG, PNG, GIF, BMP, TIFF, ICO, JPEG XR formats are supported.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">frameIndex</span></td>
      <td><p>Index of an image frame to read, pass 0 for image formats not supporting multiple frames.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a>?</td>
      <td><span class="parametername">imageRect</span></td>
      <td><p>Clipping rectangle of the image to be loaded.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_System_String_System_Int32_System_Nullable_System_Drawing_Rectangle__" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor(System.String,System.Int32,System.Nullable{System.Drawing.Rectangle})">GcWicBitmap(string, int, Rectangle?)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.html">GcWicBitmap</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcWicBitmap(string path, int frameIndex = 0, Rectangle? imageRect = null)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(path As String, Optional frameIndex As Integer = 0, Optional imageRect As Rectangle? = Nothing)</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.string">string</a></td>
      <td><span class="parametername">path</span></td>
      <td><p>The file path to the image. JPEG, PNG, GIF, BMP, TIFF, ICO, JPEG XR formats are supported.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">frameIndex</span></td>
      <td><p>Index of an image frame to read, pass 0 for image formats not supporting multiple frames.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a>?</td>
      <td><span class="parametername">imageRect</span></td>
      <td><p>Clipping rectangle of the image to be loaded.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_System_Byte___System_Int32_System_Nullable_System_Drawing_Rectangle__" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor(System.Byte[],System.Int32,System.Nullable{System.Drawing.Rectangle})">GcWicBitmap(byte[], int, Rectangle?)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.html">GcWicBitmap</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcWicBitmap(byte[] bytes, int frameIndex = 0, Rectangle? imageRect = null)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(bytes As Byte(), Optional frameIndex As Integer = 0, Optional imageRect As Rectangle? = Nothing)</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.byte">byte</a>[]</td>
      <td><span class="parametername">bytes</span></td>
      <td><p>The image data. JPEG, PNG, GIF, BMP, TIFF, ICO, JPEG XR formats are supported.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.int32">int</a></td>
      <td><span class="parametername">frameIndex</span></td>
      <td><p>Index of an image frame to read, pass 0 for image formats not supporting multiple frames.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a>?</td>
      <td><span class="parametername">imageRect</span></td>
      <td><p>Clipping rectangle of the image to be loaded.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_GrapeCity_Documents_Drawing_Image_System_Nullable_System_Drawing_Rectangle__" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor(GrapeCity.Documents.Drawing.Image,System.Nullable{System.Drawing.Rectangle})">GcWicBitmap(Image, Rectangle?)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.html">GcWicBitmap</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcWicBitmap(Image image, Rectangle? imageRect = null)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(image As Image, Optional imageRect As Rectangle? = Nothing)</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="../DS.Documents.Imaging/GrapeCity.Documents.Drawing.Image.html">Image</a></td>
      <td><span class="parametername">image</span></td>
      <td><p><a class="xref" href="../DS.Documents.Imaging/GrapeCity.Documents.Drawing.Image.html">Image</a> used as the source of image data.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.drawing.rectangle">Rectangle</a>?</td>
      <td><span class="parametername">imageRect</span></td>
      <td><p>Clipping rectangle of the image to be loaded.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_GrapeCity_Documents_Imaging_GcBitmap_GrapeCity_Documents_DX_WIC_ImagingFactory_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor(GrapeCity.Documents.Imaging.GcBitmap,GrapeCity.Documents.DX.WIC.ImagingFactory)">GcWicBitmap(GcBitmap, ImagingFactory)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.html">GcWicBitmap</a> class from an instance of <a class="xref" href="../DS.Documents.Imaging/GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a>.</p>
<p>If the source image is not opaque, the color channels must be premultiplied with the alpha channel.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcWicBitmap(GcBitmap bitmap, ImagingFactory imagingFactory = null)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(bitmap As GcBitmap, Optional imagingFactory As ImagingFactory = Nothing)</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="../DS.Documents.Imaging/GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a></td>
      <td><span class="parametername">bitmap</span></td>
      <td><p>The source <a class="xref" href="../DS.Documents.Imaging/GrapeCity.Documents.Imaging.GcBitmap.html">GcBitmap</a>.</p>
</td>
    </tr>
    <tr>
      <td><span class="xref">ImagingFactory</span></td>
      <td><span class="parametername">imagingFactory</span></td>
      <td><p>The existing imaging factory, to avoid duplicating factories.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_GrapeCity_Documents_Imaging_GcBitmap_GrapeCity_Documents_DX_WIC_ImagingFactory__seealso">See Also</h5>
<div class="seealso">
    <div><a class="xref" href="../DS.Documents.Imaging/GrapeCity.Documents.Imaging.GcBitmap.ConvertToPremultipliedAlpha.html#GrapeCity_Documents_Imaging_GcBitmap_ConvertToPremultipliedAlpha">ConvertToPremultipliedAlpha</a>()</div>
</div>


<a id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap__ctor_GrapeCity_Documents_DX_WIC_ImagingFactory_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.#ctor(GrapeCity.Documents.DX.WIC.ImagingFactory)">GcWicBitmap(ImagingFactory)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.html">GcWicBitmap</a> class.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcWicBitmap(ImagingFactory imagingFactory)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(imagingFactory As ImagingFactory)</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><span class="xref">ImagingFactory</span></td>
      <td><span class="parametername">imagingFactory</span></td>
      <td><p>The existing imaging factory, to avoid duplicating factories.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
