# GrapeCity.Documents.Imaging.Windows.GcWicBitmap.CreatePaletteFromBitmap

## Content

<div class="doc-site-dotnet-api-container">



<h1 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap_CreatePaletteFromBitmap_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.CreatePaletteFromBitmap*">CreatePaletteFromBitmap Method
</h1>
<div class="markdown level0 summary"></div>
<div class="markdown level0 conceptual"></div>



<a id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap_CreatePaletteFromBitmap_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.CreatePaletteFromBitmap*"></a>
<h4 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap_CreatePaletteFromBitmap_System_Int32_System_Boolean_" data-uid="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.CreatePaletteFromBitmap(System.Int32,System.Boolean)">CreatePaletteFromBitmap(int, bool)</h4>
<div class="markdown level1 summary"><p>Creates a palette using a computed optimized values based on the bitmap.</p>
</div>
<div class="markdown level1 conceptual"></div>
<h5 class="declaration">Declaration</h5>
<div class="codewrapper">
  <pre><code class="lang-csharp hljs">public GcWicBitmap.Palette CreatePaletteFromBitmap(int colorCount, bool addTransparentColor)</code></pre>
</div>
<div class="codewrapper">
  <pre><code class="lang-vbnet hljs">Public Function CreatePaletteFromBitmap(colorCount As Integer, addTransparentColor As Boolean) As GcWicBitmap.Palette</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">colorCount</span></td>
      <td><p>The number of colors to initialize the palette with.</p>
</td>
    </tr>
    <tr>
      <td><a class="xref" href="https://learn.microsoft.com/dotnet/api/system.boolean">bool</a></td>
      <td><span class="parametername">addTransparentColor</span></td>
      <td><p>A value to indicate whether to add a transparent color.</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.Windows.GcWicBitmap.html">GcWicBitmap</a>.<a class="xref" href="GrapeCity.Documents.Imaging.Windows.GcWicBitmap.Palette.html">Palette</a></td>
      <td></td>
    </tr>
  </tbody>
</table>
<h5 id="GrapeCity_Documents_Imaging_Windows_GcWicBitmap_CreatePaletteFromBitmap_System_Int32_System_Boolean__remarks">Remarks</h5>
<div class="markdown level1 remarks"><p>The resulting palette contains the specified number of colors which best represent the colors
present in the bitmap. The algorithm operates on the opaque RGB color value of each pixel
in the reference bitmap and hence ignores any alpha values. If a transparent color is required,
set the addTransparentColor parameter to true and one fewer optimized color will be computed,
reducing the colorCount, and a fully transparent color entry will be added.</p>
</div>
</div>
