CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-qrcode

QR Code image generator with customizable image formats, error correction levels, and styling options

42%

Overall

Evaluation42%

0.86x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-9/

QR Code Mask Pattern Comparator

Build a command-line tool that generates QR codes with different mask patterns and analyzes their visual characteristics to help determine the optimal pattern for specific use cases.

Overview

QR codes use mask patterns to distribute dark and light modules more evenly across the code, improving scannability. Different mask patterns can produce visually distinct QR codes from the same data. Your tool should generate QR codes using all available mask patterns and provide visual comparison.

Requirements

Core Functionality

Create a Python program that accepts data as input and generates multiple QR code images, one for each available mask pattern (patterns 0-7). Each generated image should be clearly labeled with its corresponding mask pattern number.

The program should:

  • Accept text data as a command-line argument
  • Generate 8 separate QR code image files, one for each mask pattern (0-7)
  • Name output files systematically to indicate the mask pattern used (e.g., qr_mask_0.png, qr_mask_1.png, etc.)
  • Use consistent error correction level (M) and box size (10) across all generated codes
  • Use consistent border width (4) across all generated codes

Output Requirements

For each mask pattern from 0 to 7:

  • Generate a PNG image file
  • Use the pattern number in the filename
  • Ensure all QR codes encode the same input data

Test Cases

  • When given the text "HELLO WORLD", the program generates 8 PNG files named qr_mask_0.png through qr_mask_7.png, each containing a valid QR code with the corresponding mask pattern applied @test

  • When given the text "https://example.com", all 8 generated QR codes decode to the same original URL when scanned, despite having different visual patterns @test

  • The generated files are saved in a clean output directory structure @test

@generates

API

def generate_qr_with_mask(data: str, mask_pattern: int, output_path: str) -> None:
    """
    Generate a QR code image with a specific mask pattern.

    Args:
        data: The text data to encode in the QR code
        mask_pattern: The mask pattern number (0-7) to apply
        output_path: The file path where the PNG image should be saved
    """
    pass

def generate_all_masks(data: str, output_dir: str = ".") -> list[str]:
    """
    Generate QR codes for all 8 mask patterns.

    Args:
        data: The text data to encode in the QR code
        output_dir: Directory where output files should be saved (default: current directory)

    Returns:
        List of generated file paths
    """
    pass

if __name__ == "__main__":
    import sys
    if len(sys.argv) < 2:
        print("Usage: python mask_comparator.py <text_data>")
        sys.exit(1)

    data = sys.argv[1]
    generate_all_masks(data)

Dependencies { .dependencies }

qrcode { .dependency }

Python QR code generation library with support for mask pattern selection.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-qrcode@7.4.0
What are skills?

tile.json