GenerateQRImageTask
Generate artistic, scannable QR codes using AI-driven image processing. Combines high-redundancy QR generation with automated scannability verification.
Category: Writing
Model: Image Agent
Error Correction: Level H (30%)
⚙️ ExecutionConfig.json
{
"files": ["brand_qr.png"],
"qr_content": "https://cognotik.com",
"style_directive": "Cyberpunk neon city,
rainy night aesthetic",
"qr_size": 512,
"max_retries": 3
}
→
🖼️ Generated Output
✓ Verified & Scannable
brand_qr.png
Live Results Showcase
Explore actual artifacts generated by this task in our test workspace.
Configuration Parameters
| Field | Type | Description |
|---|---|---|
files* |
List<String> | The output image file path. Must end with .png, .jpg, or .jpeg. |
qr_content* |
String | The data or text content to encode in the QR code. |
style_directive* |
String | Artistic style directive for the Image Agent (e.g., 'watercolor painting', 'forest background'). |
qr_size |
Int | Size of the QR code in pixels. Default: 500. |
max_retries |
Int | Maximum attempts to stylize the image if verification fails. Default: 3. |
related_files |
List<String> | Additional files for context (e.g., reference images, style guides). |
Task Execution Lifecycle
1. Base Generation
Generates a standard black-and-white QR code using Error Correction Level H (30% data redundancy), ensuring maximum resilience to artistic modifications.
2. AI Stylization
The
ImageProcessingAgent applies the style_directive. It is prompted to preserve finder patterns (corner squares) and maintain contrast.
3. Automated Verification
The task runs the generated image through multiple computer vision strategies (Grayscale, Thresholding, Contrast Enhancement) to verify it can be read by standard scanners.
4. Intelligent Retry
If verification fails, the task automatically retries with a more conservative prompt, prioritizing scannability over aggressive artistic elements.
Embedded Execution (Headless)
Use the UnifiedHarness to run this task programmatically in CI/CD or CLI tools.
import com.simiacryptus.cognotik.plan.tools.file.GenerateQRImageTask
import com.simiacryptus.cognotik.plan.tools.file.GenerateQRImageTask.GenerateQRImageTaskExecutionConfigData
import com.simiacryptus.cognotik.plan.tools.file.GenerateQRImageTask.Companion.GenerateQRImage
fun generateArtisticQR(harness: UnifiedHarness, projectDir: File) {
val config = GenerateQRImageTaskExecutionConfigData(
files = listOf("outputs/qr_code.png"),
qr_content = "https://cognotik.com",
style_directive = "Cyberpunk neon city aesthetic",
qr_size = 512
)
harness.runTask(
taskType = GenerateQRImage,
typeConfig = null, // Uses default TaskTypeConfig
executionConfig = config,
workspace = projectDir,
autoFix = true
)
}
Test Case Example
@Test
fun testQRGeneration() {
val harness = createTestHarness()
val workspace = createTempDir()
harness.runTask(
taskType = GenerateQRImage,
executionConfig = GenerateQRImageTaskExecutionConfigData(
files = listOf("test_qr.png"),
qr_content = "Test Content",
style_directive = "Minimalist line art"
),
workspace = workspace
)
assertTrue(File(workspace, "test_qr.png").exists())
}
Prompt Segment
The following text is injected into the LLM context to describe this tool:
GenerateQRImage - Generate artistic QR codes using AI image processing
** files: The output image file to be created (relative path, must end with .png, .jpg, or .jpeg)
** qr_content: The data/text content to encode in the QR code
** style_directive: Artistic style directive for the Image Agent (e.g., 'watercolor painting')
** qr_size: Size of the QR code in pixels (default: 500)
** max_retries: Maximum number of retry attempts if QR verification fails (default: 3)
** related_files: Additional files for context (e.g., reference images)