Save Barcode Images to different Formats

Skip to end of metadata
Go to start of metadata
Aspose.BarCode facilitates its developers to save the barcode images to most of the popular image formats. BarCodeBuilder class has a public method, Save() to save the image.
Images can be saved in the following formats.
  • ImageFormat.Gif
  • ImageFormat.Jpeg
  • ImageFormat.Png
  • ImageFormat.Tiff (using jai package)

Developers can use any of the image formats from the above list to create a barcode image in a desired image format. An example is given below about its usage.

Programming Example
[Java]
//Instantiate barcode object
BarCodeBuilder bb = new BarCodeBuilder();

//Set up barcode symbology
bb.setSymbologyType(Symbology.Code128);

//Set up code text (data to be encoded)
bb.setCodeText("abcedefhijklmn");

try
{
    //Save image to c:\ in jpg format
    bb.save("c:\\test.jpg", "jpg");
    //Save image to current directory in bmp format
    bb.save("test.png", "png");
}
catch (Exception ex)
{
    ex.printStackTrace();
}
 
Output

The output barcode image (in Jpeg format) generated by the code above can be seen in the below figure:

Figure: Barcode image in Jpeg format

Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.