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 Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: py_sketch_art-0.0.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b5d66b8381adc3c9d930ba01b652dd44c47b311d7c8f35215835a6817e276b5b
MD5 c1632f08c2335f1e5951e43406191976
BLAKE2b-256 6ba0525e1a7ea8a6b50361cf6882b2aacd56ae7361f51111e027c721bfcd6c79

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