How to generate barcode image with transparent background?
In This Topic
Transparent colors are supported in RGBA images, i.e. in 32- and 64-bit images.
Here is C# example that demonstrates how to generate barcode with transparent background:
public static System.Drawing.Bitmap GenerateBarcodeWithTransparentBackground(Vintasoft.Barcode.BarcodeType type, string value)
{
Vintasoft.Barcode.BarcodeWriter writer = new Vintasoft.Barcode.BarcodeWriter();
writer.Settings.Barcode = type;
writer.Settings.Value = value;
writer.Settings.PixelFormat = Vintasoft.Barcode.BarcodeImagePixelFormat.Bgra32;
writer.Settings.BackColor = System.Drawing.Color.Transparent;
return writer.GetBarcodeAsBitmap();
}
Public Shared Function GenerateBarcodeWithTransparentBackground(_
type As Vintasoft.Barcode.BarcodeType, value As String) As System.Drawing.Bitmap
Dim writer As New Vintasoft.Barcode.BarcodeWriter()
writer.Settings.Barcode = type
writer.Settings.Value = value
writer.Settings.PixelFormat = Vintasoft.Barcode.BarcodeImagePixelFormat.Bgra32
writer.Settings.BackColor = System.Drawing.Color.Transparent
Return writer.GetBarcodeAsBitmap()
End Function