# GrapeCity.Documents.Imaging.GcBitmap.ToIndexed4bppBitmap

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Imaging_GcBitmap_ToIndexed4bppBitmap_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.ToIndexed4bppBitmap*">ToIndexed4bppBitmap Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Imaging_GcBitmap_ToIndexed4bppBitmap_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.ToIndexed4bppBitmap*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap_ToIndexed4bppBitmap_System_Int32_System_Boolean_System_Boolean_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.ToIndexed4bppBitmap(System.Int32,System.Boolean,System.Boolean)">ToIndexed4bppBitmap(int, bool, bool)</h4>
<div class="markdown level1 summary"><p>Creates an opaque <a class="xref" href="GrapeCity.Documents.Imaging.Indexed4bppBitmap.html">Indexed4bppBitmap</a> from the current image using the Octree quantizer algorithm.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public Indexed4bppBitmap ToIndexed4bppBitmap(int maxColors, bool appendTransparentColor = false, bool lowerBitsFirst = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function ToIndexed4bppBitmap(maxColors As Integer, Optional appendTransparentColor As Boolean = False, Optional lowerBitsFirst As Boolean = False) As Indexed4bppBitmap</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">maxColors</span></td>
      <td><p>The maximum number of opaque colors in the palette, from 8 to 16.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">appendTransparentColor</span></td>
      <td><p>Indicates if a transparent color should be added to the palette, if the image is not opaque and the number of opaque colors is less than 16.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">lowerBitsFirst</span></td>
      <td><p>If true, pixels are arranged within a byte such that pixels with lower column indices are stored in the lower-order bit tetrads of the byte.</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="GrapeCity.Documents.Imaging.Indexed4bppBitmap.html">Indexed4bppBitmap</a></td>
      <td><p>A new instance of <a class="xref" href="GrapeCity.Documents.Imaging.Indexed4bppBitmap.html">Indexed4bppBitmap</a>.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_GcBitmap_ToIndexed4bppBitmap_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.ToIndexed4bppBitmap*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap_ToIndexed4bppBitmap_System_UInt32___GrapeCity_Documents_Imaging_DitheringMethod_System_Boolean_System_Boolean_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.ToIndexed4bppBitmap(System.UInt32[],GrapeCity.Documents.Imaging.DitheringMethod,System.Boolean,System.Boolean)">ToIndexed4bppBitmap(uint[], DitheringMethod, bool, bool)</h4>
<div class="markdown level1 summary"><p>Creates an opaque <a class="xref" href="GrapeCity.Documents.Imaging.Indexed4bppBitmap.html">Indexed4bppBitmap</a> from the current image using the specified palette.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public Indexed4bppBitmap ToIndexed4bppBitmap(uint[] palette, DitheringMethod ditheringMethod, bool appendTransparentColor = false, bool lowerBitsFirst = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function ToIndexed4bppBitmap(palette As UInteger(), ditheringMethod As DitheringMethod, Optional appendTransparentColor As Boolean = False, Optional lowerBitsFirst As Boolean = False) As Indexed4bppBitmap</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">palette</span></td>
      <td><p>The palette with opaque colors for the new image (colors are in 32-bit ARGB format). Elements with index 16 and above are ignored.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="GrapeCity.Documents.Imaging.DitheringMethod.html">DitheringMethod</a></td>
      <td><span class="parametername">ditheringMethod</span></td>
      <td><p>The method of two-dimensional error diffusion dithering.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">appendTransparentColor</span></td>
      <td><p>Indicates if a transparent color should be added to the palette, if the image is not opaque and the number of opaque colors is less than 16.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">lowerBitsFirst</span></td>
      <td><p>If true, pixels are arranged within a byte such that pixels with lower column indices are stored in the lower-order bit tetrads of the byte.</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="GrapeCity.Documents.Imaging.Indexed4bppBitmap.html">Indexed4bppBitmap</a></td>
      <td><p>A new instance of <a class="xref" href="GrapeCity.Documents.Imaging.Indexed4bppBitmap.html">Indexed4bppBitmap</a>.</p>
</td>
    </tr>
  </tbody>
</table>


<a id="GrapeCity_Documents_Imaging_GcBitmap_ToIndexed4bppBitmap_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.ToIndexed4bppBitmap*"></a>
<h4 id="GrapeCity_Documents_Imaging_GcBitmap_ToIndexed4bppBitmap_GrapeCity_Documents_Imaging_DitheringMethod_System_Boolean_" data-uid="GrapeCity.Documents.Imaging.GcBitmap.ToIndexed4bppBitmap(GrapeCity.Documents.Imaging.DitheringMethod,System.Boolean)">ToIndexed4bppBitmap(DitheringMethod, bool)</h4>
<div class="markdown level1 summary"><p>Creates an <a class="xref" href="GrapeCity.Documents.Imaging.Indexed4bppBitmap.html">Indexed4bppBitmap</a> from the current image.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public Indexed4bppBitmap ToIndexed4bppBitmap(DitheringMethod ditheringMethod, bool lowerBitsFirst = false)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function ToIndexed4bppBitmap(ditheringMethod As DitheringMethod, Optional lowerBitsFirst As Boolean = False) As Indexed4bppBitmap</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="GrapeCity.Documents.Imaging.DitheringMethod.html">DitheringMethod</a></td>
      <td><span class="parametername">ditheringMethod</span></td>
      <td><p>The method of two-dimensional error diffusion dithering.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">lowerBitsFirst</span></td>
      <td><p>If true, pixels are arranged within a byte such that pixels with lower column indices are stored in the lower-order bit tetrads of the byte.</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="GrapeCity.Documents.Imaging.Indexed4bppBitmap.html">Indexed4bppBitmap</a></td>
      <td><p>A new instance of <a class="xref" href="GrapeCity.Documents.Imaging.Indexed4bppBitmap.html">Indexed4bppBitmap</a>.</p>
</td>
    </tr>
  </tbody>
</table>
</div>
