CtrlK
CommunityDocumentationLog inGet started
Tessl Logo

tessl/pypi-asciimatics

tessl install tessl/pypi-asciimatics@1.15.0

A cross-platform package to replace curses (mouse/keyboard input & text colours/positioning) and create ASCII animations

Agent Success

Agent success rate when using this tile

81%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.33x

Baseline

Agent success rate without this tile

61%

task.mdevals/scenario-7/

ASCII Art Image Converter

Build a Python script that converts image files to greyscale ASCII art and displays them in the terminal.

Requirements

The script should:

  • Accept an image file path as a command-line argument
  • Convert the image to greyscale ASCII art
  • Resize the ASCII output to fit within a maximum width of 80 characters
  • Print the ASCII art to the terminal (stdout)
  • Handle errors gracefully (e.g., file not found)

Implementation

@generates

Test Cases

  • Converting a simple PNG image produces ASCII art output as a multi-line string. @test
  • The ASCII output width does not exceed the specified maximum width. @test
  • When given a non-existent file path, the function raises a FileNotFoundError. @test

API

def convert_image_to_ascii(image_path: str, max_width: int = 80) -> str:
    """
    Convert an image file to greyscale ASCII art.

    Args:
        image_path: Path to the image file
        max_width: Maximum width of the output in characters (default: 80)

    Returns:
        String containing the ASCII art representation with newline characters

    Raises:
        FileNotFoundError: If image file doesn't exist
    """
    pass

Dependencies { .dependencies }

asciimatics { .dependency }

Provides image to ASCII conversion functionality.

@satisfied-by

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/asciimatics@1.15.x
tile.json