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:
Clip Comparison,Anthropic Claude,Email Notification,CSV Formatter,Object Detection Model,Roboflow Dataset Upload,Multi-Label Classification Model,Stitch OCR Detections,Local File Sink,Florence-2 Model,Stitch OCR Detections,Line Counter,SIFT Comparison,Roboflow Custom Metadata,LMM,OpenAI,Twilio SMS Notification,SIFT Comparison,Template Matching,Single-Label Classification Model,Google Gemini,Google Vision OCR,Llama 3.2 Vision,OpenAI,Image Contours,VLM As Classifier,LMM For Classification,Email Notification,VLM As Detector,Anthropic Claude,Distance Measurement,OpenAI,EasyOCR,OCR Model,Instance Segmentation Model,Slack Notification,Line Counter,Detection Event Log,Google Gemini,Florence-2 Model,Pixel Color Count,Google Gemini,OpenAI,CogVLM,Webhook Sink,Anthropic Claude,Perspective Correction,Keypoint Detection Model,Model Monitoring Inference Aggregator,Twilio SMS/MMS Notification,Roboflow Dataset Upload - outputs:
Anthropic Claude,Clip Comparison,Qwen3-VL,Halo Visualization,Image Blur,Email Notification,CLIP Embedding Model,Camera Focus,Text Display,Contrast Equalization,Object Detection Model,Segment Anything 2 Model,Blur Visualization,VLM As Detector,Detections Stabilizer,Roboflow Dataset Upload,Dynamic Crop,Corner Visualization,Classification Label Visualization,Relative Static Crop,Keypoint Detection Model,Trace Visualization,Multi-Label Classification Model,SAM 3,Qwen2.5-VL,Mask Visualization,Camera Focus,SIFT,VLM As Classifier,YOLO-World Model,Background Color Visualization,Polygon Visualization,Moondream2,Barcode Detection,Florence-2 Model,Ellipse Visualization,SIFT Comparison,Pixelate Visualization,Single-Label Classification Model,LMM,SAM 3,OpenAI,Dot Visualization,Circle Visualization,Byte Tracker,Absolute Static Crop,Template Matching,Morphological Transformation,Dominant Color,Crop Visualization,Single-Label Classification Model,Google Gemini,Keypoint Visualization,Polygon Visualization,Google Vision OCR,Multi-Label Classification Model,Icon Visualization,Llama 3.2 Vision,Gaze Detection,OpenAI,Image Contours,Stitch Images,VLM As Classifier,Color Visualization,LMM For Classification,VLM As Detector,Anthropic Claude,SmolVLM2,OpenAI,Triangle Visualization,Bounding Box Visualization,Background Subtraction,Reference Path Visualization,EasyOCR,Instance Segmentation Model,Line Counter Visualization,Model Comparison Visualization,OCR Model,Halo Visualization,Time in Zone,Stability AI Inpainting,Image Slicer,Google Gemini,Florence-2 Model,Image Convert Grayscale,Stability AI Image Generation,Heatmap Visualization,Pixel Color Count,Seg Preview,Polygon Zone Visualization,Image Slicer,Label Visualization,Google Gemini,Depth Estimation,Image Preprocessing,Detections Stitch,OpenAI,Object Detection Model,Stability AI Outpainting,Buffer,QR Code Detection,Image Threshold,Anthropic Claude,Instance Segmentation Model,CogVLM,Perception Encoder Embedding Model,Camera Calibration,Perspective Correction,SAM 3,Motion Detection,Keypoint Detection Model,Twilio SMS/MMS Notification,Roboflow Dataset Upload,Clip Comparison
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"
}