ZXing Barcode icon

ZXing Barcode

Generate and scan barcodes using ZXing library

Actions2

Overview

The node provides barcode generation and scanning capabilities using the ZXing library. It supports creating various barcode formats from text input and decoding barcodes from images. This node is useful in automation workflows where you need to generate barcodes for labeling, inventory management, or encode data visually. It also helps extract information from barcode images, such as QR codes or product barcodes, enabling automated data capture from scanned images.

Practical examples:

  • Generate a QR code containing a URL or contact information to embed in marketing materials.
  • Scan a barcode image received from an external source to automatically retrieve encoded product details.
  • Decode multiple barcode formats from images uploaded by users in a workflow.

Properties

Name Meaning
Image Source Source of the image to scan; options are:
- Binary Data (image comes from binary property)
- Base64 (image provided as base64 string)
Binary Property Name of the binary property containing the image (used if Image Source is Binary Data)
Base64 Data Base64 encoded image data string (used if Image Source is Base64)
Try Harder Whether to try harder to decode the barcode; this makes scanning slower but more accurate
Return Format Info Whether to include the detected barcode format in the output JSON

Output

The node outputs an array of items with the following structure when scanning:

  • json.text: The decoded text content from the barcode.
  • json.format (optional): The detected barcode format name (e.g., "QR_CODE"), included if "Return Format Info" is enabled.
  • json.formatType (optional): The internal format type identifier.
  • json.timestamp: Timestamp of the decoding event.
  • json.numBits: Number of bits decoded from the barcode.
  • json.imageInfo: Object containing image metadata (width, height, channels) of the processed image.
  • pairedItem: Index of the input item paired with this output.

If the node is configured to generate barcodes (not requested here), it outputs the generated barcode image as base64 PNG binary data along with metadata.

Dependencies

  • Uses the ZXing library for barcode encoding and decoding.
  • Uses the Sharp library for image processing (resizing, greyscale conversion, normalization, sharpening).
  • Requires input images either as binary data from previous nodes or as base64 strings.
  • No external API keys or services are required; all processing is local within the node.

Troubleshooting

  • No binary data found for property: Ensure the previous node outputs binary image data under the specified binary property name.
  • Base64 data is required for scanning: When using base64 as image source, provide valid base64-encoded image data.
  • No barcode found in the provided image: The image may be low quality, have a colored background, or the barcode is damaged. Try enabling "Try Harder", use higher resolution images, or improve lighting conditions.
  • Failed to decode barcode after trying multiple image processing approaches: Indicates that the node attempted several image enhancements but could not find a valid barcode. Verify the image quality and barcode visibility.
  • Failed to process image: Input might not be a valid image file or is corrupted.

Enabling "Try Harder" increases decoding accuracy at the cost of performance.

Links and References

Discussion