Skip to content

Commit

Permalink
Fixed and improved the content of pages related to the Aspose.Barcod…
Browse files Browse the repository at this point in the history
…e for Android via Java product.
  • Loading branch information
alex-grinin committed Feb 8, 2025
1 parent 8ca8d73 commit 05fd828
Show file tree
Hide file tree
Showing 3 changed files with 153 additions and 67 deletions.
25 changes: 17 additions & 8 deletions androidjava/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,25 @@ description: Android Barcode API provides the tools to generate barcode images a

**Welcome to Aspose.BarCode for Android via Java**

Aspose.BarCode for Android via Java API provides developers with tools required to generate barcode images and read barcodes in Android applications. You can not only generate barcodes of different types but also modify their properties and size. You can also customize the appearance of barcode elements and text.
***Aspose.BarCode for Android via Java*** is a powerful library for barcode generation and recognition,
designed for seamless integration into Android applications. It provides a comprehensive set of classes for backend barcode
processing, along with GUI-based controls. Supporting most existing barcode standards and specifications,
Aspose.BarCode for Android via Java ensures high compatibility. In addition to barcode generation, the library
offers advanced features for managing key aspects of barcode processing, making it a versatile tool for
developers.

{{% /alert %}}

## **Aspose.BarCode for Android via Java Resources**
## **Aspose.BarCode for Android via Java Resources**

Following are the links to some useful resources you may need to accomplish your tasks.
<p>Following are the links to some useful resources you may need to accomplish your tasks:</p>

<ul>

[//]: # ( <li><a href="/barcode/androidjava/" target="_blank">Aspose.BarCode for Java Online Documentation</a></li>)
<li><a href="/barcode/java/aspose-barcode-for-android-via-java-features/" target="_blank">Aspose.BarCode for Android via Java Features</a></li>
<li><a href="https://releases.aspose.com/barcode/androidjava/release-notes/" target="_blank">Aspose.BarCode for Android via Java Release Notes</a></li>
<li><a href="https://products.aspose.com/barcode/android-java/" target="_blank">Aspose.BarCode for Android via Java Product Page</a></li>
<li><a href="https://reference.aspose.com/java/barcode/" target="_blank">Aspose.BarCode for Android via Java API Reference Guide</a></li>
</ul>

- [Aspose.BarCode for Java Online Documentation](/barcode/androidjava/)
- [Aspose.BarCode for Android via Java Features](/barcode/java/aspose-barcode-for-android-via-java-features/)
- [Aspose.BarCode for Android via Java Release Notes](https://releases.aspose.com/barcode/androidjava/release-notes/)
- [Aspose.BarCode for Android via Java Product Page](https://products.aspose.com/barcode/android-java/)
- [Aspose.BarCode for Android via Java API Reference Guide](https://reference.aspose.com/java/barcode/) 
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,22 @@ description: "How to Save Generated Barcodes in Aspose.BarCode for Android"
keywords: "Generate Barcodes, Save Barcode in Android, Download Barcode in Aspose.BarCode for Android, Generate Barcodes in Aspose.BarCode, Save To File Aspose Barcode, Barcode Vector Format, Generate Vector Barcodes, Save Barcode as JPEG, Save Barcode as PNG, Save Barcode as BMP, Save Barcode as TIFF, Save Barcode as GIF"
url: /androidjava/barcode-image-saving/
---

This article outlines the ways of outputting generated barcode images as files, streams, or bitmaps, as well as various raster (PNG, JPEG, BMP, GIF, and TIFF) and vector (SVG and EMF) image file formats.

## **Overview**
During barcode generation, it may be required to save barcode images not only in common raster image formats but also as streams or vector files. ***Aspose.BarCode for Android via Java*** enables different options of saving generated barcodes: five common image formats, two vector formats, and some other ways, such as outputting barcode labels to a file, stream, or a bitmap). These options are discussed further.

{{% alert color="primary" %}}*If you need any clarifications, feel free to reach out [Aspose Technical Support](/barcode/java/technical-support/): ask your questions at [Aspose.Barcode Forum](https://forum.aspose.com/c/barcode/13) or contact [Aspose Paid Support Helpdesk](https://helpdesk.aspose.com/).*{{% /alert %}}
During barcode generation, it may be required to save barcode images not only in common raster image formats
but also as streams or vector files. ***Aspose.BarCode for Android via Java*** enables different options of
saving generated barcodes: five common image formats, two vector formats, and some other ways, such as
outputting barcode labels to a file, stream, or a bitmap). These options are discussed further.

{{% alert color="primary" %}}*If you need any clarifications, feel free to reach
out [Aspose Technical Support](/barcode/java/technical-support/): ask your questions
at [Aspose.Barcode Forum](https://forum.aspose.com/c/barcode/13) or
contact [Aspose Paid Support Helpdesk](https://helpdesk.aspose.com/).*{{% /alert %}}

## **Saving to File**
***Aspose.BarCode for Android via Java*** enables saving generated barcode images as files in the desired format.

***Aspose.BarCode for Android via Java*** enables saving generated barcode images as files in the desired
format.
<!--The code sample given below explains how to use this setting.
{{< highlight csharp>}}
Expand All @@ -24,7 +30,11 @@ gen.Save($"{path}StoreImageAsFile.png", BarCodeImageFormat.Png);
{{< /highlight >}}-->

## **Saving to Stream**
It may be necessary to output generated barcode images in the form of a stream, in other words, in a binary format. A stream can be viewed as a byte sequence abstraction. To save barcode images as streams, class [*BarcodeGenerator*](https://reference.aspose.com/barcode/androidjava/com.aspose.barcode.generation/BarcodeGenerator) provides the public method *save*<!--, as shown in the code snippet below-->.

It may be necessary to output generated barcode images in the form of a stream, in other words, in a binary
format. A stream can be viewed as a byte sequence abstraction. To save barcode images as streams, class [
*BarcodeGenerator*](https://reference.aspose.com/barcode/androidjava/com.aspose.barcode.generation/BarcodeGenerator)
provides the public method *save*<!--, as shown in the code snippet below-->.

<!--{{< highlight csharp>}}
using (Stream str = new FileStream($"{path}StoreImageAsStream.png", FileMode.Create, FileAccess.Write))
Expand All @@ -35,7 +45,12 @@ using (Stream str = new FileStream($"{path}StoreImageAsStream.png", FileMode.Cre
{{< /highlight >}}-->

## **Saving as Bitmap**
***Aspose.BarCode for Android via Java*** enables saving barcode images in the form of bitmap objects and then converting it to the required format or using it in graphical transformations. These objects can be fetched from instances of class [*BarcodeGenerator*](https://reference.aspose.com/barcode/androidjava/com.aspose.barcode.generation/BarcodeGenerator) through the *generateBarCodeImage* method and then processed further.

***Aspose.BarCode for Android via Java*** enables saving barcode images in the form of bitmap objects and then
converting it to the required format or using it in graphical transformations. These objects can be fetched
from instances of class [
*BarcodeGenerator*](https://reference.aspose.com/barcode/androidjava/com.aspose.barcode.generation/BarcodeGenerator)
through the *generateBarCodeImage* method and then processed further.
<!--The following code sample shows how to use this output option in ***Aspose.BarCode for Android via Java***.
{{< highlight csharp>}}
Expand All @@ -46,64 +61,87 @@ using (Bitmap bmp = gen.GenerateBarCodeImage())

## **Raster Image Formats**

In ***Aspose.BarCode for Android via Java***, barcode images can be saved to common raster image formats, namely, PNG, GIF, BMP, JPEG, and TIFF. The value of the [*BarCodeImageFormat*](https://reference.aspose.com/barcode/androidjava/com.aspose.barcode.generation/BarCodeImageFormat) enum can be passed as the second argument to the *save()* method to output barcode images in the specified format. The description of all supported image formats is given further.
In ***Aspose.BarCode for Android via Java***, barcode images can be saved to common raster image formats,
namely, PNG, GIF, BMP, JPEG, and TIFF. The value of the [
*BarCodeImageFormat*](https://reference.aspose.com/barcode/androidjava/com.aspose.barcode.generation/BarCodeImageFormat)
enum can be passed as the second argument to the *save()* method to output barcode images in the specified
format. The description of all supported image formats is given further.

### **BMP Format**
BMP images are bitmap files that store bitmap digital images regardless of a graphics adapter. The BMP file format enables storing information as two-dimensional digital images in monochrome and color formats with different color depths. Using the BMP format for image generation results in producing images without compression. In this case, barcode images will have large size and 24-bit color depth. Moreover, they will not contain losses and artifacts.

BMP images are bitmap files that store bitmap digital images regardless of a graphics adapter. The BMP file
format enables storing information as two-dimensional digital images in monochrome and color formats with
different color depths. Using the BMP format for image generation results in producing images without
compression. In this case, barcode images will have large size and 24-bit color depth. Moreover, they will not
contain losses and artifacts.
<!--The code snippet provided below illustrates how to save barcode images in the BMP format.
{{< highlight csharp>}}
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128, "12345678");
//save as BMP
gen.Save($"{path}RasterImageBmp.bmp", BarCodeImageFormat.Bmp);
{{< /highlight >}}-->

The sample BMP barcode image is given below.

<p align="center"><image src="rasterimagebmp.bmp"></p>

### **PNG Format**
Portable Network Graphics (PNG) is a raster image format that is used for lossless data compression. This format is the most preferable to generate barcode labels. Images created using this format have 32-bit color depth and no losses.

Portable Network Graphics (PNG) is a raster image format that is used for lossless data compression. This
format is the most preferable to generate barcode labels. Images created using this format have 32-bit color
depth and no losses.
<!--The following code sample explains how to save barcode images in the PNG format.
{{< highlight csharp>}}
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128, "12345678");
//save as Png
gen.Save($"{path}RasterImagePng.png", BarCodeImageFormat.Png);
{{< /highlight >}}-->

The sample barcode image in the PNG format is provided below.

<p align="center"><image src="rasterimagebmp.bmp"></p>

### **GIF Format**
Graphics Interchange Format (GIF) is a lossless raster file format that supports only 256 colors and enables creating both static and animated images. ***Aspose.BarCode for Android via Java*** allows using this format only for black and white raster images. The code following code snippet explains how to generate barcodes in the GIF format.


Graphics Interchange Format (GIF) is a lossless raster file format that supports only 256 colors and enables
creating both static and animated images. ***Aspose.BarCode for Android via Java*** allows using this format
only for black and white raster images. The code following code snippet explains how to generate barcodes in
the GIF format.

<!--{{< highlight csharp>}}
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128, "12345678");
//save as Gif
gen.Save($"{path}RasterImageGif.gif", BarCodeImageFormat.Gif);
{{< /highlight >}}-->

The GIF barcode image generated using this code is shown below.

<p align="center"><image src="rasterimagegif.gif"></p>

### **JPEG Format**
JPEG is a common image file format used for lossy and compressed image data. As a result of compression, generating JPEG images require finding a trade-off between image quality and storage size and therefore often have artifacts and graphical noises. This file format is not recommended for barcode generation. The following code sample shows how to create JPEG barcode images.

JPEG is a common image file format used for lossy and compressed image data. As a result of compression,
generating JPEG images require finding a trade-off between image quality and storage size and therefore often
have artifacts and graphical noises. This file format is not recommended for barcode generation. The following
code sample shows how to create JPEG barcode images.

<!--{{< highlight csharp>}}
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128, "12345678");
//save as Jpeg
gen.Save($"{path}RasterImageJpeg.jpeg", BarCodeImageFormat.Jpeg);
{{< /highlight >}}-->

The example of a JPEG barcode image is given below.

<p align="center"><image src="rasterimagejpeg.jpeg"></p>

### **TIFF (TIFFInCMYK) Format**
Tagged Image File Format (TIFF) is a lossless raster image format that allows creating images of very high quality and 32-bit color. Only a variation of this format, TIFFInCMYK, supports the CMYK color scheme. The code snippet provided below explains how to generate barcode images in the TIFF format.

Tagged Image File Format (TIFF) is a lossless raster image format that allows creating images of very high
quality and 32-bit color. Only a variation of this format, TIFFInCMYK, supports the CMYK color scheme. The
code snippet provided below explains how to generate barcode images in the TIFF format.

<!--{{< highlight csharp>}}
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128, "12345678");
Expand All @@ -114,36 +152,51 @@ gen.Save($"{path}RasterImageTiffInCmyk.tiff", BarCodeImageFormat.TiffInCmyk);
{{< /highlight >}}-->

TIFF and TIFFInCMYK barcode images are given below.
|Output Format|TIFF|TIFFInCMYK|
| :-: | :-: | :-: |
| |<a href="rasterimagetiff.tiff"><img src="rasterimagepng.png" alttext="Saving to TIFF format"></a>|<a href="rasterimagetiffincmyk.tiff"><img src="rasterimagepng.png" alttext="Saving to TIFFInCMYK format"></a>|

| Output Format | TIFF | TIFFInCMYK |
|:-------------:|:-------------------------------------------------------------------------------------------------:|:-------------------------------------------------------------------------------------------------------------:|
| | <a href="rasterimagetiff.tiff"><img src="rasterimagepng.png" alttext="Saving to TIFF format"></a> | <a href="rasterimagetiffincmyk.tiff"><img src="rasterimagepng.png" alttext="Saving to TIFFInCMYK format"></a> |

## **Vector Image Formats**
Vector image formats represent images as a set of graphical operations executed consequently on a graphics unit. Vector images can be generated through mathematical formulas that specify points on a grid. This format allows scaling without resolution losses. Accordingly, vector image formats may be more suitable than raster ones in some cases. ***Aspose.BarCode for Android via Java*** supports outputting barcode images in two vector formats: EMF and SVG.

Vector image formats represent images as a set of graphical operations executed consequently on a graphics
unit. Vector images can be generated through mathematical formulas that specify points on a grid. This format
allows scaling without resolution losses. Accordingly, vector image formats may be more suitable than raster
ones in some cases. ***Aspose.BarCode for Android via Java*** supports outputting barcode images in two vector
formats: EMF and SVG.

### **EMF Format**
Enhanced Metafile (EMF) is a vector image format that is device-independent and is commonly used in Windows operating systems for printing tasks. An EMF image file comprise variable-length records in chronological order. Then, a vector image can be rendered on any output device. Such records can serve to represent objects, drawing commands, and graphics parameters that are critical to render vector images. When a digital device opens an EMF metafile through its graphics environment, dimension paraneters, proportions, color scheme, and other graphics properties of the source image do not get altered on any platform.

Enhanced Metafile (EMF) is a vector image format that is device-independent and is commonly used in Windows
operating systems for printing tasks. An EMF image file comprise variable-length records in chronological
order. Then, a vector image can be rendered on any output device. Such records can serve to represent objects,
drawing commands, and graphics parameters that are critical to render vector images. When a digital device
opens an EMF metafile through its graphics environment, dimension paraneters, proportions, color scheme, and
other graphics properties of the source image do not get altered on any platform.
<!--The following code sample shows how to generate EMF barcode images.
{{< highlight csharp>}}
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128, "12345678");
//save as Emf
gen.Save($"{path}VectorImageEmf.emf", BarCodeImageFormat.Emf);
{{< /highlight >}}-->

<a href="vectorimageemf.emf"> <p align="center"><img src="rasterimagepng.png" alttext="Saving to EMF format"> </p></a>

<a href="vectorimageemf.emf"> <p align="center"><img src="rasterimagepng.png" alttext="Saving to EMF format"> </p></a>

### **SVG Format**
Scalable Vector Graphics (SVG) corresponds to an vector image format based on XML. It is used to create two-dimensional images in web applications. In SVG images, the image appearance is described in XML text. Such files can be scaled to various size measures keeping resolution quality. Accordingly, this vector image format is suitable for websites and graphics printing owing to its capability to resize images in line with various design requirements.


Scalable Vector Graphics (SVG) corresponds to an vector image format based on XML. It is used to create
two-dimensional images in web applications. In SVG images, the image appearance is described in XML text. Such
files can be scaled to various size measures keeping resolution quality. Accordingly, this vector image format
is suitable for websites and graphics printing owing to its capability to resize images in line with various
design requirements.

<!--The following code snippet explains how to create SVG barcode images.
{{< highlight csharp>}}
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code128, "12345678");
//save as Svg
gen.Save($"{path}VectorImageSvg.svg", BarCodeImageFormat.Svg);
{{< /highlight >}}-->

<p align="center"><image src="vectorimagesvg.svg"></p>
Loading

0 comments on commit 05fd828

Please sign in to comment.