# GrapeCity.Documents.Imaging.Windows.GcWicBitmap.ToByteArray

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap_ToByteArray_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.ToByteArray*">ToByteArray Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap_ToByteArray_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.ToByteArray*"></a>
<h4 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap_ToByteArray" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.ToByteArray">ToByteArray()</h4>
<div class="markdown level1 summary"><p>Stores the image buffer to a byte array (without the palette and metadata information).</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public byte[] ToByteArray()</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function ToByteArray() As Byte()</code></pre>
</div>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</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></td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap_ToByteArray_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.ToByteArray*"></a>
<h4 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap_ToByteArray_System_Int32__" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.ToByteArray(System.Int32@)">ToByteArray(out int)</h4>
<div class="markdown level1 summary"><p>Stores the image buffer to a byte array with the same stride (bytes per row).</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public byte[] ToByteArray(out int stride)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function ToByteArray(ByRef stride As Integer) As Byte()</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">stride</span></td>
      <td><p>Returns the stride (bytes per row) of the image.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</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></td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap_ToByteArray_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.ToByteArray*"></a>
<h4 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap_ToByteArray_System_Drawing_Rectangle_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.ToByteArray(System.Drawing.Rectangle)">ToByteArray(Rectangle)</h4>
<div class="markdown level1 summary"><p>Stores a rectangular area of the image to a byte array.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public byte[] ToByteArray(Rectangle srcRect)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function ToByteArray(srcRect As Rectangle) As Byte()</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.drawing.rectangle">Rectangle</a></td>
      <td><span class="parametername">srcRect</span></td>
      <td><p>The source rectangle within the image.</p>
</td>
    </tr>
  </tbody>
</table>
<h5 class="returns">Returns</h5>
<table class="table table-bordered table-condensed">
  <thead>
    <tr>
      <th>Type</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></td>
    </tr>
  </tbody>
</table>
</div>
