Output Image Format
ImageFormat class defines the image type created by DynamicBarcode Creator for .NET and includes several static image formats defined for quick use. These static members simplify your code significantly when the image output type does not require much customization.
The static ImageFormat types are as follows.
- ImageFormat.Bmp
- ImageFormat.Gif
- ImageFormat.Jpeg
- ImageFormat.Png
- ImageFormat.TiffWithCcitGroup3
- ImageFormat.TiffWithCcitGroup4
- ImageFormat.TiffWithLzw
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, you can also set its properties directly rather than specifying the ImageFormat in the constructor. Instantiate one of the following classes to pass into the barcode's Draw method.
- ceTe.DynamicBarcode.Creator.BmpImageFormat
- ceTe.DynamicBarcode.Creator.GifImageFormat
- ceTe.DynamicBarcode.Creator.JpegImageFormat
- ceTe.DynamicBarcode.Creator.PngImageFormat
- ceTe.DynamicBarcode.Creator.TiffImageFormat
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)