Output Image Format

ImageFormat class allows defining the type of image created by DynamicBarcode Creator for .NET and includes several static image formats defined for quick use. These static members simplify your code significantly when image output type does not require much customization. These static ImageFormat types are as follows.

The following example illustrates the syntax required to create a PNG barcode using a static PNG ImageFormat.

Codabar barcode = new Codabar("A1234A", 100);
barcode.Draw(pngFilePath, 300, ImageFormat.Png);        
Dim barcode As Codabar = New Codabar("A1234A", 100)
barcode.Draw(pngFilePath, 300, ImageFormat.Png)    

Alternatively, rather than specifying the ImageFormat in the constructor, you can also set its properties directly. Instantiate one of the following classes to pass into the barcode's Draw method:

The following example illustrates the syntax required to create a barcode of PNG format using an RgbA color format.

Codabar barcode = new Codabar("A1234A", 100);
PngImageFormat image = new PngImageFormat(PngColorFormat.Rgba);
barcode.Draw(pngFilePath, 300, image);        
Dim barcode As Codabar = New Codabar("A1234A", 100)
Dim MyPng As PngImageFormat = New PngImageFormat(PngColorFormat.RgbA)
barcode.Draw(pngFilePath, 300, MyPng)

In this topic