Skip to main content

QuantizationAlgorithm Enum

Version: 2.0

QuantizationAlgorithm Enum

Represents different kind of quantization methods.

public enum QuantizationAlgorithm
Public Enum QuantizationAlgorithm

Inheritance: Object → ValueType → Enum → QuantizationAlgorithm

Fields​

QuantizationAlgorithm.MedianCut1Represents MedianCut type of quantization.
QuantizationAlgorithm.Octree0Represents Octree type of quantization.

Licensing​

This class is a DynamicPDF Rasterizer feature. The following license is required for non-evaluation usage:

  • DynamicPDF Rasterizer for .NET

Examples​

This example demonstrates the usage of QuantizationAlgorithm enum in indexed image creation.

Imports System
Imports ceTe.DynamicPDF.Rasterizer

Module MyModule

Sub Main()

' Create a PdfRasterizer object.
Dim rasterizer As New PdfRasterizer("InputPdfFile.pdf")

' Create a PngIndexedColorFormat object.
Dim pngIndexedColorFormat As New PngIndexedColorFormat(ImageFormat.DefaultColorPalette,100,DitheringAlgorithm.FloydSteinberg)

' Set the Colorpalette property to AutoPalette.
pngIndexedColorFormat.ColorPalette = New AutoPalette(QuantizationAlgorithm.Octree, 256)

' Create a PngImageFormat using PngIndexedColorFormat object.
Dim pngImageFormat As New PngImageFormat(pngIndexedColorFormat)

' Set the size.
Dim fixedImageSize As New FixedImageSize(595, 841)

' Save the image.
rasterizer.Draw("Output.png", pngImageFormat, fixedImageSize)

End Sub

End Module
using System;
using ceTe.DynamicPDF.Rasterizer;

class MyClass
{
static void Main(string[] args)
{ // Create a PdfRasterizer object.
PdfRasterizer rasterizer = new PdfRasterizer("InputPdfFile.pdf");

// Create a PngIndexedColorFormat object.
PngIndexedColorFormat pngIndexedColorFormat = new PngIndexedColorFormat(ImageFormat.DefaultColorPalette,100,DitheringAlgorithm.FloydSteinberg);

// Set the Colorpalette property to AutoPalette.
pngIndexedColorFormat.ColorPalette = new AutoPalette(QuantizationAlgorithm.Octree, 256);

// Create a PngImageFormat using PngIndexedColorFormat object.
PngImageFormat pngImageFormat = new PngImageFormat(pngIndexedColorFormat);

// Set the size.
FixedImageSize fixedImageSize = new FixedImageSize(595, 841);

// Save the image.
rasterizer.Draw("Output.png", pngImageFormat, fixedImageSize);

}

}

See Also​

ceTe.DynamicPDF.Rasterizer