Skip to main content

Output Image Format

Version: 1.0

Output Image Format

ImageFormat class allows you to define the type of image created by DynamicBarcode Creator for .NET. Several static ImageFormats are defined for quick use. These static members simplify your code significantly when image output type do not need a lot of customization. These static ImageFormats are as follows:

The below example illustrates the syntax that would be needed to create barcode into a PNG image using a static PNG ImageFormat.

Codabar barcode = new Codabar("A1234A", 100);
barcode.Draw(@"C:\\barcode.png", 300, ImageFormat.Png);
Dim barcode As Codabar = New Codabar("A1234A", 100)
barcode.Draw("C:\\barcode.png", 300, ImageFormat.Png)

Alternatively you can just instantiate the ImageFormat type that you need to use and set up it's properties directly. In this case you need to instantiate one of the following objects to pass into the barcode's Draw method:

The below example illustrates the syntax that would be needed 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(@"C:\\barcode.png", 300, image);
Dim barcode As Codabar = New Codabar("A1234A", 100)
Dim MyPng As PngImageFormat = New PngImageFormat(PngColorFormat.RgbA)
barcode.Draw("C:\\barcode.png", 300, MyPng)
Documentation version