Skip to main content

A collection of functions to generate various visual representations of text in SVG format

Project description

codecov PyPI Downloads

Encoderize

A Python package for generating various visual representations of text in SVG format.

Installation

  1. Install Ghostscript (required for barcode generation):

    • Windows: Download and install from Ghostscript website
    • Linux: sudo apt-get install ghostscript
    • macOS: brew install ghostscript
  2. Install the package:

pip install -e .

Features

Generates SVG visualizations of text using 10 distinct encoding methods:

  1. Binary Stripe: Binary bar code representation
  2. Morse Code Band: Dots and dashes visualization
  3. Circuit Trace Silhouette: Circuit board-like pattern (5x7 grid per character)
  4. Dot Grid Steganography: Grid with highlighted letters
  5. Semaphore Flags: Flag position visualization
  6. A1Z26 Numeric Stripe: Numeric representation of letters (A=1, Z=26)
  7. Code128 Barcode: Standard Code128 barcode format
  8. Waveform Stripe: Waveform visualization based on character ASCII values
  9. Chevron Stripe: Chevron pattern based on binary representation
  10. Braille Stripe: Visual representation of Braille characters

Usage

encoderize --text "HELLO" --output-dir output

Options:

  • --text, -t: Text to visualize (required)
  • --output-dir, -o: Output directory (default: 'output')
  • --dark: Generate dark mode versions (white on black)
  • --light: Generate light mode versions (black on white)

If neither --dark nor --light is specified, both versions will be generated.

Example Visualizations

WIP

Output Structure

For input text like "HELLO", the output structure will be:

output/
└── HELLO/
    ├── light/
    │   ├── binary_stripe_HELLO.svg
    │   ├── morse_code_band_HELLO.svg
    │   ├── circuit_trace_silhouette_HELLO.svg
    │   ├── dot_grid_steganography_HELLO.svg
    │   ├── semaphore_flags_HELLO.svg
    │   ├── a1z26_stripe_HELLO.svg
    │   ├── code128_barcode_HELLO.svg
    │   ├── waveform_stripe_HELLO.svg
    │   ├── chevron_stripe_HELLO.svg
    │   └── braille_stripe_HELLO.svg
    └── dark/
        ├── binary_stripe_HELLO.svg
        ├── morse_code_band_HELLO.svg
        └── ... (and so on for all 10 types)

Customization

Each visualization function in encoderize/visualizers.py accepts optional parameters to customize the appearance (e.g., colors, sizes, spacing, dimensions).

See the function docstrings within encoderize/visualizers.py for detailed parameter information.

Development

Install development dependencies:

pip install -e ".[dev]"

Run tests:

pytest

Run linters (e.g., flake8, black):

# Example using flake8
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# Example using black
black . --check

Requirements

  • Python 3.8 or higher
  • svgwrite
  • treepoem (and its dependency Ghostscript for barcode generation)

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions are welcome! Please see the CONTRIBUTING.md file for details on how to report bugs, suggest features, and submit pull requests.

Contact

For questions or feedback, please contact Hayden MacDonald at haydenpmac@gmail.com.

Contributors

Made with contrib.rocks.

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

encoderize-0.1.1.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

encoderize-0.1.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

Details for the file encoderize-0.1.1.tar.gz.

File metadata

  • Download URL: encoderize-0.1.1.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for encoderize-0.1.1.tar.gz
Algorithm Hash digest
SHA256 8f0ee772c6c847c7861c2499c646b77a5630c93870dc9674d696c23ab702a575
MD5 53550064dff078318d653d968e87318d
BLAKE2b-256 483c224d5c09164d67e13542ae536a0e32c18b4125b6fc70f74f1e19a66862da

See more details on using hashes here.

File details

Details for the file encoderize-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: encoderize-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for encoderize-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3ed3a0ff478a69feeb83798de1671ee30182fcd7bf99f09093f00596cad48131
MD5 0b655cb64f07d7ca22c780a3d2386b3b
BLAKE2b-256 36a566c27bb6c8496d4766671085508d5004f79b867e3fefd850f50e217ce7e6

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