Skip to main content

Convert images to packed monochrome C arrays for dot-matrix displays, with interactive editor.

Project description

adot-image-creator

Convert images to packed monochrome C arrays for dot-matrix displays, with an optional interactive bitmap editor.

Features

  • Load common bitmap formats (PNG, JPG, BMP, ...) as grayscale
  • Optional SVG support via cairosvg (extra dependency)
  • Automatically scale and center image into target width/height
  • Convert image to monochrome bytes optimized for dot-matrix displays (8-pixel pages)
  • Optional interactive editor (Tkinter GUI) to fine-tune individual pixels
  • Generate C-style hexadecimal dump including width/height header

Installation

From PyPI

Once published, you will be able to install the package via:

pip install adot-image-creator

To enable SVG input support, install with the svg extra:

pip install "adot-image-creator[svg]"

Command-line usage

The package exposes a console script named adot-image-creator.

adot-image-creator -i INPUT -H HEIGHT -w WIDTH [options]

Arguments:

  • -i, --input – input image file (PNG, JPG, SVG, BMP, ...), required
  • -H, --height – target height in pixels (1–255), required
  • -w, --width – target width in pixels (1–255), required
  • -t, --threshold – threshold level between white and black (0–10, default: 5)
  • -s, --scale – pixel scale for interactive editor (logical pixel = s × s screen pixels, default: 4)

Example:

adot-image-creator \
  -i logo.png \
  -H 32 \
  -w 64 \
  -t 5 \
  -s 4

The tool will:

  1. Load and resize the image to fit into the specified width/height.
  2. Convert it to monochrome using the given threshold.
  3. Optionally open a Tkinter-based editor where you can flip individual pixels.
  4. Show a preview of the resulting bitmap.
  5. Print a C-style hex dump to standard output, including height and width bytes.

You can redirect the output directly into a C source file, for example:

adot-image-creator -i logo.png -H 32 -w 64 > logo_bitmap.c

Library usage

The same functionality is available from Python code via the adot_image_creator package.

from adot_image_creator import (
    load_image,
    to_monochrome_bytes,
    bytes_to_bool_matrix,
    bool_matrix_to_bytes,
    interactive_edit_bitmap,
    preview_from_bytes,
    format_hexdump,
)

# Load and prepare an image
img = load_image("logo.png", width=64, height=32)

# Convert to monochrome bytes (0–10 threshold)
raw_bytes = to_monochrome_bytes(img, threshold_level=5)

# Optionally let the user tweak pixels in a small GUI editor
bitmap = bytes_to_bool_matrix(width=64, height=32, data=raw_bytes)
edited_bitmap = interactive_edit_bitmap(width=64, height=32, bitmap=bitmap, scale=4)
final_bytes = bool_matrix_to_bytes(width=64, height=32, bitmap=edited_bitmap)

# Preview result in a simple image viewer
preview_from_bytes(width=64, height=32, data=final_bytes)

# Generate C hex dump
hexdump = format_hexdump(height=32, width=64, data=final_bytes)
print(hexdump)

Dependencies

  • Pillow – required for image loading and processing
  • cairosvg – optional, required only when working with SVG/SVGZ input ([svg] extra)
  • tkinter – optional, used only for the interactive bitmap editor (may not be available in some environments)

License

This project is distributed under a proprietary 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

adot_image_creator-3.1.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

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

adot_image_creator-3.1.0-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file adot_image_creator-3.1.0.tar.gz.

File metadata

  • Download URL: adot_image_creator-3.1.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for adot_image_creator-3.1.0.tar.gz
Algorithm Hash digest
SHA256 e04b6996ef3a99bb62b1720f0644d0938e445e0a04e181ac20f08c8a54d06675
MD5 b25f12dc6b0b3df638732f44635aba46
BLAKE2b-256 917cbcc2413f198f496895521110ad637aebc38e39accf3970131e9c4fbbf8b2

See more details on using hashes here.

File details

Details for the file adot_image_creator-3.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for adot_image_creator-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5ca119c203c4bd5f14d660851f634f6a5006ab6725d2c63e0e967641cc9811f8
MD5 c7c1ed095a7a6b5f2fee2cf2b62cab22
BLAKE2b-256 86666f81cc80aa53f86044ccd421fcb2037879bf961d3aaabf815361ad3653b0

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