BarcodeImage

BarcodeImage["string"]

generates a barcode image of "string" in the "QR" format.

BarcodeImage["string",format]

generates a barcode image of "string" in the specified format.

BarcodeImage["string",format,size]

attempts to generate a barcode image of the specified size.

Details

  • BarcodeImage always returns a binary image.
  • Possible values for size include:
  • widthapproximate width, height is computed automatically
    {width,height}approximate width and height
  • If the specified size does not provide sufficient resolution for generating the barcode, an image of a larger size is generated. »
  • The following 1D barcode formats can be used for format:
  • "UPC"UPC-A12 numerical digits
    "UPCE"UPC-E8 numerical digits
    "EAN8"EAN-88 numerical digits
    "EAN13"EAN-1313 numerical digits
    "Code39"Code 39up to 80 characters of uppercase letters, numeric digits, special characters -, ., $, /, +, %, and space
    "Code93"Code 93uppercase letters, numeric digits, special characters -, ., $, /, +, %, and space
    "Code128"Code 128up to 80 ASCII characters
    "ITF"ITFup to 80 numerical digits of an even length
    "Codabar"Codabarnumerical digits and special characters :, /, +, .
  • The following 2D barcode formats can be used for format:
  • "Aztec"Aztec (error correction 2)3000 ASCII or 3748 numeric
    {"Aztec", lev}Aztec (error correction lev)ASCII characters (less storage for higher levels)
    "DataMatrix"Data Matrix code2335 ASCII or 3116 numeric
    "QR"QR (error correction 2)2953 ASCII, 7089 numeric or 4296 alphanumeric
    {"QR",lev}QR (error correction lev)ASCII characters (less storage for higher levels)
    "PDF417"PDF417 (error correction 2)up to 1781 ASCII characters
    {"PDF417",lev}PDF417 (error correction lev)ASCII characters (less storage for higher levels)
  • The error correction level lev can be an integer between 0 and 8.

Examples

open allclose all

Basic Examples  (4)

Generate a QR code from a URL:

Explicitly specify the barcode type:

Generate a QR barcode of the specified size:

Generate a UPC barcode:

Scope  (16)

Generate a UPC barcode from a 12-digit numerical code:

With an 11-digit code, the checksum is automatically computed:

Generate a UPC barcode from an 8-digit numerical code:

With a 7-digit code, the checksum is automatically computed:

Generate an EAN-8 barcode:

With a 7-digit code, the checksum is automatically computed:

Generate an EAN-13 barcode from a 13-digit numerical code:

With a 12-digit code, the checksum is automatically computed:

Generate a Code 39 barcode from numerical digits:

Generate a Code 39 barcode from an alphanumeric string:

Generate a Code 93 barcode from numerical digits:

Generate a Code 39 barcode from an alphanumeric string:

Generate a Code 128 barcode:

Generate an ITF barcode:

Generate a Codabar barcode:

Generate an Aztec code:

Generate an Aztec code with the error correction level 7:

Generate a Data Matrix code:

Generate a QR code:

Generate a QR code with the error correction level 4:

Generate a PDF 417 code:

Generate a PDF 417 code with the error correction level 6:

Applications  (3)

Encode a URL in a Code 39 barcode:

Encode graphics in a QR code:

Decode and evaluate the expression:

Add a QR code to a plot as an visual watermark:

Decode the QR code:

Properties & Relations  (4)

Use BarcodeRecognize to convert a barcode image to a string:

Compute the UPC-A checksum from an 11-digit code:

The checksum is automatically computed if not provided and used as the 12th digit:

Compute the EAN-8 checksum for a 7-digit code:

BarcodeImage automatically computes the checksum:

Compute the EAN-13 checksum for a 12-digit code:

BarcodeImage automatically computes the checksum:

Possible Issues  (4)

In generating 1D barcode images, the width specification might be ignored:

The resulting width is the minimum required to represent the barcode image:

In generating 2D barcode images, the size specification might be ignored:

Different formats have requirements for the input string, including length and supported characters:

For formats with a checksum character, an incorrect checksum is replaced with the correct value:

Neat Examples  (1)

Create two barcode images and color them based on the dominant colors of the US flag:

Compose barcode images to create a barcoded US flag:

Recognize barcodes in the image:

Wolfram Research (2014), BarcodeImage, Wolfram Language function, https://reference.wolfram.com/language/ref/BarcodeImage.html (updated 2023).

Text

Wolfram Research (2014), BarcodeImage, Wolfram Language function, https://reference.wolfram.com/language/ref/BarcodeImage.html (updated 2023).

CMS

Wolfram Language. 2014. "BarcodeImage." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2023. https://reference.wolfram.com/language/ref/BarcodeImage.html.

APA

Wolfram Language. (2014). BarcodeImage. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/BarcodeImage.html

BibTeX

@misc{reference.wolfram_2023_barcodeimage, author="Wolfram Research", title="{BarcodeImage}", year="2023", howpublished="\url{https://reference.wolfram.com/language/ref/BarcodeImage.html}", note=[Accessed: 19-March-2024 ]}

BibLaTeX

@online{reference.wolfram_2023_barcodeimage, organization={Wolfram Research}, title={BarcodeImage}, year={2023}, url={https://reference.wolfram.com/language/ref/BarcodeImage.html}, note=[Accessed: 19-March-2024 ]}