# GrapeCity.Documents.Imaging.GrayscaleBitmap.-ctor

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Imaging_GrayscaleBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GrayscaleBitmap.#ctor*">GrayscaleBitmap Constructor
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Imaging_GrayscaleBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GrayscaleBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_GrayscaleBitmap__ctor_System_Int32_System_Int32_System_Boolean_System_Boolean_System_Single_System_Single_" data-uid="GrapeCity.Documents.Imaging.GrayscaleBitmap.#ctor(System.Int32,System.Int32,System.Boolean,System.Boolean,System.Single,System.Single)">GrayscaleBitmap(int, int, bool, bool, float, float)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.GrayscaleBitmap.html">GrayscaleBitmap</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 GrayscaleBitmap(int pixelWidth, int pixelHeight, bool transparencyMask = false, bool whiteIsZero = false, 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, Optional transparencyMask As Boolean = False, Optional whiteIsZero 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.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">transparencyMask</span></td>
      <td><p>If true, the image is used to define an irregularly shaped region of another image.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">whiteIsZero</span></td>
      <td><p>If true, specifies that 0 is imaged as white and 255 is imaged as black.</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_GrayscaleBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GrayscaleBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_GrayscaleBitmap__ctor_System_Byte___System_Int32_System_Int32_System_Boolean_System_Boolean_System_Single_System_Single_" data-uid="GrapeCity.Documents.Imaging.GrayscaleBitmap.#ctor(System.Byte[],System.Int32,System.Int32,System.Boolean,System.Boolean,System.Single,System.Single)">GrayscaleBitmap(byte[], int, int, bool, bool, float, float)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.GrayscaleBitmap.html">GrayscaleBitmap</a> class and sets 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 GrayscaleBitmap(byte[] pixelData, int pixelWidth, int pixelHeight, bool transparencyMask = false, bool whiteIsZero = false, float dpiX = 96, float dpiY = 96)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(pixelData As Byte(), pixelWidth As Integer, pixelHeight As Integer, Optional transparencyMask As Boolean = False, Optional whiteIsZero 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.byte">byte</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.GrayscaleBitmap.html">GrayscaleBitmap</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">transparencyMask</span></td>
      <td><p>If true, the image is used to define an irregularly shaped region of another image.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">whiteIsZero</span></td>
      <td><p>If true, specifies that 0 is imaged as white and 255 is imaged as black.</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_GrayscaleBitmap__ctor_" data-uid="GrapeCity.Documents.Imaging.GrayscaleBitmap.#ctor*"></a>
<h4 id="GrapeCity_Documents_Imaging_GrayscaleBitmap__ctor_System_IntPtr_System_Int32_System_Int32_System_Boolean_System_Boolean_System_Single_System_Single_" data-uid="GrapeCity.Documents.Imaging.GrayscaleBitmap.#ctor(System.IntPtr,System.Int32,System.Int32,System.Boolean,System.Boolean,System.Single,System.Single)">GrayscaleBitmap(IntPtr, int, int, bool, bool, float, float)</h4>
<div class="markdown level1 summary"><p>Initializes a new instance of the <a class="xref" href="GrapeCity.Documents.Imaging.GrayscaleBitmap.html">GrayscaleBitmap</a> class and sets 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 GrayscaleBitmap(IntPtr pixelData, int pixelWidth, int pixelHeight, bool transparencyMask = false, bool whiteIsZero = false, float dpiX = 96, float dpiY = 96)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Sub New(pixelData As IntPtr, pixelWidth As Integer, pixelHeight As Integer, Optional transparencyMask As Boolean = False, Optional whiteIsZero 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.GrayscaleBitmap.html">GrayscaleBitmap</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">transparencyMask</span></td>
      <td><p>If true, the image is used to define an irregularly shaped region of another image.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">whiteIsZero</span></td>
      <td><p>If true, specifies that 0 is imaged as white and 255 is imaged as black.</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>
