IRONSOFTWAREHOME
Write 1-BPP Barcodes Images
using IronBarCode;

var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);

myBarcode.SaveAs1BppBitmap("1bppImage.bmp");
var byteData = myBarcode.To1BppBinaryData();
var anyBitmap = myBarcode.To1BppImage();
Imports IronBarCode

Dim myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8)

myBarcode.SaveAs1BppBitmap("1bppImage.bmp")
Dim byteData = myBarcode.To1BppBinaryData()
Dim anyBitmap = myBarcode.To1BppImage()
NuGet Download
PM > Install-Package BarCode
Write 1-BPP Barcodes Images

Write 1-BPP Barcodes Images

A 1bpp image is a monochrome image that can display only two colors, typically black and white. Each pixel in the picture is represented by a single bit, where "0" may represent black and "1" may represent white, or vice versa. This format is best suited for scenarios where speed and accuracy are essential, and it is intended to be read by machines. In this code example, we will demonstrate how to convert the barcode we created into a 1bpp image for maximum contrast and reliability when scanning.

5-Step Guide to Converting Barcodes into 1BPP Barcode Images

  • using IronBarCode;
  • var myBarcode = BarcodeWriter.CreateBarcode("12345", BarcodeWriterEncoding.EAN8);
  • myBarcode.SaveAs1BppBitmap("1bppImage.bmp");
  • var byteData = myBarcode.To1BppBinaryData();
  • var anyBitmap = myBarcode.To1BppImage();

Code Explanation

We first import the IronBarcode library, then we generate a barcode using the BarcodeWriter.CreateBarcode method. We pass two variables to the method: the string value and the type of the barcode. In the example above, these are "12345" and EAN8, respectively.

After creating the barcode, we can call the save method SaveAs1BppBitmap and pass it a file name. Doing this saves the barcode as a 1bpp Bitmap with the name being the file name it's saved as.

Aside from saving it directly to a Bitmap, there are also alternative save methods. IronBarcode supports saving the barcode as 1bpp binary data using the To1BppBinaryData method. Converting to binary data allows you to pass the variable as binary data to other sections of the application or integrate with existing code bases. Furthermore, IronBarcode also supports saving the barcode as a 1-bit-per-pixel (1bpp) image using the To1BppImage method.

View on GitHub

Ready to Get Started?

Nuget Downloads 2,422,100Version:2026.9just released

Key in blue circle

Get your free 30-day Trial Key instantly.

Your trial license will be sent to your email address

No limitations. 100% unlocked. No credit card.

bullet_checkedNo credit card or account creation requiredNo limitations. 100% unlocked. No credit card.
  • Logo Aetna
  • Logo NASA
  • Logo GE
  • Logo Porsche
  • Logo USDA
  • Logo Qatar
Join Millions of Engineers who’ve tried IronPDF
Book your free Live Demo
Booking Badge

Trusted by Millions of Engineers Worldwide

Iron Software's customer logos
Get Your No-Obligation Consult
Complete the form below or email sales@ironsoftware.com
Your details will always be kept confidential.
Trusted by Millions of Engineers Worldwide
Iron Software's customer logos
Get your free 30-day Trial Key instantly.
No credit card or account creation required