QR Code Generator¶
Class: QRCodeGeneratorBlockV1
Source: inference.core.workflows.core_steps.transformations.qr_code_generator.v1.QRCodeGeneratorBlockV1
Generate QR code images from text input (URLs, text content, or other data) with customizable error correction levels, visual styling (colors, borders), and automatic size optimization, producing PNG images suitable for embedding, printing, or further image processing in workflows.
How This Block Works¶
This block creates QR code images from text input using the qrcode library, encoding the provided text into a scannable QR code pattern. The block:
- Receives text input (URLs, strings, or other data to encode) and QR code configuration parameters
- Checks an internal LRU cache for previously generated QR codes with the same parameters (caching improves performance for repeated QR code generation)
- Parses color specifications for fill and background colors (supports hex codes, RGB strings, standard color names, and CSS3 color names) using a common color utility
- Maps the error correction level string to the corresponding qrcode library constant (Low, Medium, Quartile, or High error correction)
- Creates a QRCode object with the specified parameters:
- Auto-determines version (size) based on data length when version is None
- Sets error correction level based on the selected option
- Uses fixed box_size of 10 pixels per module
- Applies the specified border width
- Encodes the text data into the QR code pattern
- Generates a PIL Image from the QR code with the specified fill and background colors
- Converts the image to RGB format, then to a NumPy array
- Converts from RGB (PIL format) to BGR (OpenCV/WorkflowImageData format) for compatibility with workflow image processing
- Creates a WorkflowImageData object with the QR code image and metadata
- Stores the result in the cache for future reuse (cache has 100 entry capacity and 1-hour TTL)
- Returns the QR code image
The block automatically optimizes QR code size based on the data length (auto-sizing), ensuring the QR code is large enough to encode the data but not unnecessarily large. Error correction levels trade off between data capacity and error recovery: higher error correction allows the QR code to be scanned even if partially damaged or obscured, but reduces the maximum data capacity. The block uses caching to improve performance when generating the same QR codes multiple times, which is common in workflows that generate QR codes for the same URLs or data repeatedly.
Common Use Cases¶
- URL and Link Encoding: Generate QR codes for URLs and web links (e.g., create QR codes for product pages, generate QR codes for documentation links, encode URLs for easy mobile access), enabling quick access to web resources via QR code scanning
- Data Encoding and Sharing: Encode text data, identifiers, or information into QR codes (e.g., generate QR codes for product IDs, encode serial numbers, create QR codes for inventory tracking), enabling machine-readable data encoding and sharing
- Document and Report Generation: Include QR codes in generated documents or reports (e.g., add QR codes to PDF reports linking to detailed data, embed QR codes in generated images, include QR codes in formatted outputs), enabling interactive document features with scannable links
- Workflow Result Sharing: Generate QR codes linking to workflow results or outputs (e.g., create QR codes pointing to detection results, encode links to analysis reports, generate QR codes for sharing workflow outputs), enabling easy sharing and access to workflow-generated content
- Label and Tag Generation: Create QR codes for labeling and identification purposes (e.g., generate QR codes for asset tags, create QR codes for product labels, encode identification information), enabling automated label and tag creation workflows
- Integration and Automation: Generate QR codes as part of automated workflows (e.g., create QR codes for automated document processing, generate QR codes for workflow automation triggers, encode data for system integration), enabling QR code generation as part of automated processes
Connecting to Other Blocks¶
This block receives text input and produces QR code images:
- After data processing blocks (e.g., Expression, Property Definition) that produce text output to encode computed values, URLs, or processed data into QR codes, enabling machine-readable encoding of workflow-generated data
- Before visualization blocks that can overlay or combine QR codes with other images (e.g., overlay QR codes on images, combine QR codes with detection visualizations, embed QR codes in composite images), enabling QR code integration into visual outputs
- Before formatter blocks (e.g., CSV Formatter) to include QR code references or links in formatted outputs, enabling QR code integration into structured data exports
- Before sink blocks (e.g., Local File Sink, Webhook Sink) to save or send generated QR code images, enabling QR code distribution and storage
- In document generation workflows where QR codes need to be embedded in documents or reports, enabling interactive document features with scannable codes
- After detection or analysis blocks to generate QR codes linking to detection results or analysis outputs, enabling easy sharing and access to workflow results via QR code scanning
Type identifier¶
Use the following identifier in step "type" field: roboflow_core/qr_code_generator@v1to add the block as
as step in your workflow.
Properties¶
| Name | Type | Description | Refs |
|---|---|---|---|
name |
str |
Enter a unique identifier for this step.. | ❌ |
text |
str |
Text, URL, or data to encode into the QR code. Can be any string content including URLs (e.g., 'https://roboflow.com'), text messages, identifiers, serial numbers, or other data. The QR code will automatically size itself based on the data length. Longer text requires larger QR codes or lower error correction levels to fit. Maximum data capacity depends on the error correction level selected.. | ✅ |
error_correct |
str |
Error correction level that determines how much damage or obscuration the QR code can tolerate while still being scannable. Higher error correction allows scanning even if the QR code is partially damaged, obscured, or transformed, but reduces the maximum data capacity (text length). Choose 'Low' for maximum data capacity when QR codes will be clearly visible and undamaged. Choose 'Medium' (default) for balanced capacity and error recovery. Choose 'Quartile' or 'High' when QR codes may be partially obscured, damaged, or need to be scanned from difficult angles. Trade-off: higher error correction = better error recovery but less data capacity.. | ❌ |
border |
int |
Border thickness in modules (QR code units). Defaults to 4 modules. The border is a quiet zone around the QR code pattern that helps QR code scanners identify and decode the code. Larger borders improve scanning reliability but increase image size. Minimum recommended border is 4 modules. Border is measured in QR code modules (not pixels - actual pixel border size depends on box_size which is fixed at 10 pixels per module).. | ✅ |
fill_color |
str |
Color of the QR code pattern blocks (the dark squares in the QR code). Defaults to 'BLACK'. Supports multiple color formats: hex codes (e.g., '#FF0000' for red, '#000000' for black), RGB strings (e.g., 'rgb(255, 0, 0)'), standard color names (e.g., 'BLACK', 'WHITE', 'RED', 'BLUE'), or CSS3 color names. The fill color should contrast well with the background color for reliable scanning. Traditional black-on-white provides the best scanning reliability.. | ✅ |
back_color |
str |
Background color of the QR code (the light areas between pattern blocks). Defaults to 'WHITE'. Supports multiple color formats: hex codes (e.g., '#FFFFFF' for white, '#000000' for black), RGB strings (e.g., 'rgb(255, 255, 255)'), standard color names (e.g., 'BLACK', 'WHITE', 'RED', 'BLUE'), or CSS3 color names. The background color should contrast well with the fill color for reliable scanning. Traditional white background with black fill provides the best scanning reliability.. | ✅ |
The Refs column marks possibility to parametrise the property with dynamic values available
in workflow runtime. See Bindings for more info.
Available Connections¶
Compatible Blocks
Check what blocks you can connect to QR Code Generator in version v1.
- inputs:
SIFT Comparison,LMM,Twilio SMS Notification,Roboflow Custom Metadata,Llama 3.2 Vision,Template Matching,OpenAI,Email Notification,Detection Event Log,EasyOCR,Google Gemini,Roboflow Dataset Upload,Twilio SMS/MMS Notification,Single-Label Classification Model,Clip Comparison,CogVLM,Google Vision OCR,Stitch OCR Detections,Multi-Label Classification Model,VLM as Detector,LMM For Classification,Slack Notification,OpenAI,Local File Sink,Anthropic Claude,Google Gemini,Webhook Sink,Perspective Correction,Florence-2 Model,Instance Segmentation Model,Anthropic Claude,Object Detection Model,VLM as Classifier,CSV Formatter,Pixel Color Count,Image Contours,Line Counter,Google Gemini,Florence-2 Model,SIFT Comparison,Line Counter,Keypoint Detection Model,OCR Model,OpenAI,Roboflow Dataset Upload,Distance Measurement,Email Notification,Model Monitoring Inference Aggregator,Anthropic Claude,OpenAI - outputs:
Icon Visualization,Image Preprocessing,LMM,Blur Visualization,Moondream2,Morphological Transformation,Stitch Images,Color Visualization,Contrast Equalization,Gaze Detection,Llama 3.2 Vision,Stability AI Image Generation,Template Matching,Image Blur,Reference Path Visualization,Circle Visualization,SIFT,OpenAI,Buffer,SAM 3,Perception Encoder Embedding Model,Halo Visualization,EasyOCR,Google Gemini,Roboflow Dataset Upload,Trace Visualization,Twilio SMS/MMS Notification,Instance Segmentation Model,Single-Label Classification Model,VLM as Detector,Classification Label Visualization,Clip Comparison,Image Convert Grayscale,CogVLM,Google Vision OCR,Background Color Visualization,Multi-Label Classification Model,Qwen2.5-VL,QR Code Detection,Single-Label Classification Model,Camera Calibration,VLM as Detector,Segment Anything 2 Model,LMM For Classification,Triangle Visualization,Text Display,CLIP Embedding Model,SAM 3,Ellipse Visualization,Seg Preview,Multi-Label Classification Model,Barcode Detection,OpenAI,Mask Visualization,Anthropic Claude,Absolute Static Crop,Google Gemini,Time in Zone,Polygon Zone Visualization,Polygon Visualization,Model Comparison Visualization,Label Visualization,Line Counter Visualization,Perspective Correction,Florence-2 Model,Dominant Color,Image Slicer,Instance Segmentation Model,Stability AI Outpainting,Object Detection Model,Anthropic Claude,Keypoint Detection Model,VLM as Classifier,Relative Static Crop,Byte Tracker,Image Slicer,Pixel Color Count,VLM as Classifier,Image Contours,Stability AI Inpainting,Camera Focus,Google Gemini,Motion Detection,Florence-2 Model,Object Detection Model,SIFT Comparison,Detections Stitch,Keypoint Detection Model,Dot Visualization,Camera Focus,YOLO-World Model,Crop Visualization,Clip Comparison,Bounding Box Visualization,OCR Model,Background Subtraction,OpenAI,SAM 3,Detections Stabilizer,Roboflow Dataset Upload,Qwen3-VL,Dynamic Crop,Keypoint Visualization,Email Notification,Image Threshold,Anthropic Claude,Corner Visualization,Depth Estimation,OpenAI,Pixelate Visualization,SmolVLM2
Input and Output Bindings¶
The available connections depend on its binding kinds. Check what binding kinds
QR Code Generator in version v1 has.
Bindings
-
input
text(string): Text, URL, or data to encode into the QR code. Can be any string content including URLs (e.g., 'https://roboflow.com'), text messages, identifiers, serial numbers, or other data. The QR code will automatically size itself based on the data length. Longer text requires larger QR codes or lower error correction levels to fit. Maximum data capacity depends on the error correction level selected..border(integer): Border thickness in modules (QR code units). Defaults to 4 modules. The border is a quiet zone around the QR code pattern that helps QR code scanners identify and decode the code. Larger borders improve scanning reliability but increase image size. Minimum recommended border is 4 modules. Border is measured in QR code modules (not pixels - actual pixel border size depends on box_size which is fixed at 10 pixels per module)..fill_color(string): Color of the QR code pattern blocks (the dark squares in the QR code). Defaults to 'BLACK'. Supports multiple color formats: hex codes (e.g., '#FF0000' for red, '#000000' for black), RGB strings (e.g., 'rgb(255, 0, 0)'), standard color names (e.g., 'BLACK', 'WHITE', 'RED', 'BLUE'), or CSS3 color names. The fill color should contrast well with the background color for reliable scanning. Traditional black-on-white provides the best scanning reliability..back_color(string): Background color of the QR code (the light areas between pattern blocks). Defaults to 'WHITE'. Supports multiple color formats: hex codes (e.g., '#FFFFFF' for white, '#000000' for black), RGB strings (e.g., 'rgb(255, 255, 255)'), standard color names (e.g., 'BLACK', 'WHITE', 'RED', 'BLUE'), or CSS3 color names. The background color should contrast well with the fill color for reliable scanning. Traditional white background with black fill provides the best scanning reliability..
-
output
qr_code(image): Image in workflows.
Example JSON definition of step QR Code Generator in version v1
{
"name": "<your_step_name_here>",
"type": "roboflow_core/qr_code_generator@v1",
"text": "https://roboflow.com",
"error_correct": "Low (~7% word recovery / highest data capacity)",
"border": 2,
"fill_color": "BLACK",
"back_color": "WHITE"
}