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.2.tar.gz (4.8 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.2-py3-none-any.whl (2.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_sketch_art-0.0.2.tar.gz
  • Upload date:
  • Size: 4.8 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.2.tar.gz
Algorithm Hash digest
SHA256 515741a54771b8f620fbbd502886ca64bc903a878b58e643339bf7005052adc8
MD5 e9832362c613cca795848155e1c4b17e
BLAKE2b-256 9b5c77a3738966dd6712226403af013a8e9a9495460f7c60a1cae97835c76a1a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: py_sketch_art-0.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b260c57929bec707e6c9756fa33c63b183506706b9bc2ed33f359ddc301e0ff7
MD5 1bb943e965ff4f9069077a1a01fd1b31
BLAKE2b-256 cc937a1a3b920787dcaa9687a65f4d983741756d3cccc9db5ff42bbeead3ce78

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