Skip to main content

A Python library for animating drawings of images and generating ASCII art.

Project description

Welcome to Sketchpy (Reimagined)

This is a reimagined and refactored version of the sketchpy library, designed for easier use and better organization. It allows you to create drawing animations from images, generate ASCII art, and draw predefined celebrity sketches using the turtle module.

Features

  • Image Sketching: Convert any image into a line-drawing animation.
  • ASCII Art Generation: Transform images into ASCII art.
  • SVG Sketching: Draw complex SVG paths.
  • Predefined Drawings: Sketch famous personalities like APJ Abdul Kalam, Vijay, Tom Holland, and Robert Downey Jr.
  • Simplified Interface: Run all operations from a single script with command-line arguments.

Installation

To install the sketchpy library, you can use pip:

pip install sketchpy

Note: This package is currently under development and not yet available on PyPI. The installation instructions will be updated once it's published.

Usage

The library provides a simplified command-line interface through run_sketchpy.py to perform various operations. You can use it as follows:

python run_sketchpy.py --operation <operation_name> [arguments]

Operations

1. Image Sketching (sketch)

This operation converts an image into a line drawing. It includes an automatic tracing feature, so you only need to provide the image path.

Example:

python run_sketchpy.py --operation sketch --image_path path/to/your/image.jpg --save True --retain True

Arguments:

  • --image_path: Path to the input image (required).
  • --save: Save the drawn sketch as a PNG file (default: False).
  • --retain: Keep the drawing window open after sketching (default: False).
  • --x_offset: X-offset for the drawing position (default: 300).
  • --y_offset: Y-offset for the drawing position (default: 300).
  • --mode: Drawing mode (1 for lines, 0 for fill; default: 1).
  • --thickness: Line thickness for drawing (default: 1).
  • --threshold: Threshold for automatic edge detection during tracing (default: 100).
  • --simplify_factor: Factor to simplify the number of points in the trace (default: 5).

2. ASCII Art Generation (ascii)

Convert an image into ASCII art, displayed using the turtle module.

Example:

python run_sketchpy.py --operation ascii --image_path path/to/your/image.png --save True

Arguments:

  • --image_path: Path to the input image (required).
  • --save: Save the ASCII art as a screenshot (default: True).
  • --x_len: Pixel movement in X direction (default: 5).
  • --y_len: Pixel movement in Y direction (default: 7).

3. SVG Sketching (svg)

Draw an image from an SVG file. Note that this feature might require additional setup for proper rendering, as the original library's SVG handling is complex.

Example:

python run_sketchpy.py --operation svg --image_path path/to/your/vector.svg --scale 500

Arguments:

  • --image_path: Path to the SVG file (required).
  • --scale: Zoom value for the SVG (default: 500).
  • --x_offset: X-offset for the drawing position (default: 0).
  • --y_offset: Y-offset for the drawing position (default: 0).
  • --save: Save the drawn sketch as a PNG file (default: True).

4. Predefined Drawings (apj, vijay, tom_holland, rdj)

Draw predefined sketches of famous personalities.

Examples:

python run_sketchpy.py --operation apj
python run_sketchpy.py --operation vijay
python run_sketchpy.py --operation tom_holland
python run_sketchpy.py --operation rdj

Arguments (common for predefined drawings):

  • --x_offset: X-offset for the drawing position (default: 300 or 370 depending on the drawing).
  • --y_offset: Y-offset for the drawing position (default: 300).
  • --retain: Keep the drawing window open after sketching (default: True for some, False for others in original).

Development & Contribution

Feel free to contribute to this project by submitting pull requests or reporting issues. The goal is to make sketchpy more robust, user-friendly, and feature-rich.

License

This project is licensed under the MIT License.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_sketch_art-0.0.3.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_sketch_art-0.0.3-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

Details for the file py_sketch_art-0.0.3.tar.gz.

File metadata

  • Download URL: py_sketch_art-0.0.3.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for py_sketch_art-0.0.3.tar.gz
Algorithm Hash digest
SHA256 2e17e052efca2e1f45902b1138ce51df1989ab10c0441efc877f3221ff382df1
MD5 e9611d34252ff7437730994222d4c733
BLAKE2b-256 0be88ae81b3b5b781a0b53bc38393649b3d7a164ad37e4dc5fecb0fb3682f63f

See more details on using hashes here.

File details

Details for the file py_sketch_art-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: py_sketch_art-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 2.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc1

File hashes

Hashes for py_sketch_art-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 da96deef559bec196208263b5ea59158260a693dd2a471909522593ae8e0fd11
MD5 d2f5508a8009f06c073f9c744a605997
BLAKE2b-256 daeeef0d701e12a4a8b4bac94d60ec5574933ee181b213bc52fc5abf7ade632b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page