Skip to main content

petiglyph is a TUI and CLI tool for turning images and videos into custom font glyphs

Project description

petiglyph

petiglyph is a TUI and CLI tool for turning images and videos into custom font glyphs.

Demo video

Quickstart

1. Installation

Choose one:

npm install -g petiglyph
pip install petiglyph
yay -S petiglyph

You can also download a prebuilt binary from GitHub Releases.

Make sure ffmpeg is available on PATH.

2. Usage

In a terminal, go in the folder where you want the project to be, and type:

petiglyph

This opens the TUI Home panel, where you can create a project and start importing media to create glyphs, grids, and animations.

Generated glyphs can be of 4 types:

  • standard monospace, static
  • standard monospace, animated
  • grid of glyphs, static
  • grid of glyphs, animated

[!WARNING]
After installing petiglyph fonts, you need to reboot all instances of the terminal you're using, or, if it doesn't work, reboot your computer, to make sure the new fonts are correctly loaded by your apps or system.

For all 4 types, petiglyph will generate the static and animated glyphs in the Installed petiglyph fonts area of the Home panel after installing the fonts.

To copy those glyphs for reusing them elsewhere, you have to navigate with your arrows to the Installed petiglyph fonts area, select the glyphs that you want, press ENTER to copy them to your clipboard, and paste them in your own tools or apps (those apps need to also have the new fonts loaded, see warning above).

Pressing ENTER on the animated glyphs copies all frames inside the clipboard. To see them animated, you need to make your own script to render all the glyphs into an animation.


Documentation

Installation and runtime prerequisites

Each project is self-contained:

my-font/
  petiglyph.toml
  images/
  build/

images/ holds source images and imported animation frames, build/ holds generated artifacts, and petiglyph.toml holds project config.

Distribution surfaces in this repo:

  • GitHub Releases: prebuilt archives
  • AUR: petiglyph
  • npm: petiglyph
  • PyPI: petiglyph

Install examples:

npm install -g petiglyph
pip install petiglyph
yay -S petiglyph

Runtime requirement:

  • ffmpeg must be available on PATH before petiglyph starts.
  • Interactive runs show an OS-aware install hint when ffmpeg is missing.
  • To let petiglyph run the suggested install command for that run, pass --ffmpeg-auto-install.
  • To suppress the one-time hint globally, set PETIGLYPH_NO_FFMPEG_PROMPT=1.

Create a project and open the TUI

petiglyph create my-font
cd my-font
petiglyph

petiglyph with no subcommand launches the TUI. petiglyph tui does the same explicitly.

Fast path from images to a font

Import a few images as glyphs:

petiglyph glyph create \
  --input ../assets/logo.png \
  --input ../assets/mark.svg

Build the font artifacts:

petiglyph build

Install the built font into the current user font directory:

petiglyph install-font

Build, install, refresh font state, and print the sample text you can paste into a terminal:

petiglyph sample

First animation flow

Create an animated glyph from a GIF or video:

petiglyph animation create-standard \
  --input ../assets/run.mp4 \
  --fps 8 \
  --name run

What the TUI is for

The TUI is the primary interface for:

  • importing glyphs, grids, and animations through the Home panel workflows
  • previewing glyphs without aspect-ratio distortion
  • tuning per-glyph threshold and invert overrides
  • building, installing, uninstalling, and sampling fonts
  • selecting projects when no single manifest is auto-detected

On Windows, the Home creation workflows use a native file picker.

Command reference

Core commands:

petiglyph create <name>
petiglyph create <name> --no-launch
petiglyph
petiglyph tui
petiglyph list
petiglyph delete
petiglyph build
petiglyph sample
petiglyph install-font
petiglyph uninstall-font
petiglyph uninstall-all-fonts
petiglyph doctor

Glyph commands:

petiglyph set-threshold <image> <threshold>
petiglyph clear-threshold <image>

petiglyph glyph create --input <path> [--input <path>...]
petiglyph glyph set-threshold <image> <threshold>
petiglyph glyph clear-threshold <image>
petiglyph glyph set-invert <image> --invert on|off

Composition and animation commands:

petiglyph grid create --input <path> --rows <n> --cols <n>
petiglyph composition set <image> --rows <n> --cols <n>
petiglyph composition clear <image>

petiglyph animation create-standard --input <path> --fps <n>
petiglyph animation create-grid --input <path> --rows <n> --cols <n> --fps <n>
petiglyph animation set-fps <name> --fps <n>
petiglyph animation delete <name>

Useful build-time options:

petiglyph build --force-remap
petiglyph sample --force-remap
petiglyph install-font --force-remap

petiglyph uninstall is intentionally a hidden stub that exits with guidance to use uninstall-font or uninstall-all-fonts.

Project resolution and TUI launch behavior

Project-scoped commands accept --manifest to target a specific project.

When --manifest is omitted, petiglyph checks:

  1. ./petiglyph.toml
  2. one directory level below the current directory

Behavior after discovery:

  • exactly one project: that project is used
  • zero projects: CLI commands fail with guidance; TUI opens on the Home panel
  • multiple projects: CLI commands fail with guidance; TUI opens on the Home panel

list and uninstall-all-fonts are not manifest-scoped.

petiglyph and petiglyph tui require an interactive terminal. In non-TTY contexts they fail with an explicit terminal-required error.

JSON automation contract

--json is supported on:

  • list
  • delete
  • set-threshold
  • clear-threshold
  • glyph create
  • glyph set-threshold
  • glyph clear-threshold
  • glyph set-invert
  • grid create
  • composition set
  • composition clear
  • animation create-standard
  • animation create-grid
  • animation set-fps
  • animation delete
  • build
  • sample
  • install-font
  • uninstall-font
  • uninstall-all-fonts
  • doctor

Envelope shape:

{
  "ok": true,
  "command": "build",
  "version": "0.1.0",
  "data": {}
}

Failure rules:

  • non-zero exit code
  • ok: false
  • stable top-level fields: ok, command, version, data
  • error.message always present on failures
  • optional error.causes[] for nested context
  • no extra human-oriented logs on stdout in JSON mode

Manifest format

Default manifest values:

input_dir = "images"
out_dir = "build"
font_name = "Petiglyph"
glyph_size = 64
threshold = 64
codepoint_start = "U+100000"

Common managed sections:

[threshold_overrides]
"logo.png" = 72

[invert_overrides]
"logo.png" = true

[compositions."sheet.png"]
rows = 4
cols = 4
horizontal_bleed = "weak"
vertical_bleed = "off"

Notes:

  • project_id is managed automatically and may be written back to the manifest during normal reads/builds.
  • animation entries may also be normalized and written back during normal reads/builds.
  • threshold_overrides and invert_overrides are keyed relative to input_dir.
  • composition bleed defaults are horizontal_bleed = "weak" and vertical_bleed = "off".

Supported inputs

Direct build inputs in images/:

  • png
  • jpg
  • jpeg
  • webp
  • bmp
  • gif
  • svg

Import-only conversion path:

  • avif can be imported through CLI/TUI workflows, but it is converted to project-local .png files before build input scanning.

Animated creation workflows also accept:

  • gif
  • mp4
  • mov
  • mkv
  • webm
  • avi
  • m4v

Media-processing limits:

  • maximum 1200 extracted frames per media input
  • maximum 3000 extracted frames per import operation

Build outputs

petiglyph build recreates out_dir and writes:

  • <font-slug>.ttf
  • <font-slug>.bdf
  • glyph-map.json
  • glyph-sample.txt
  • previews/*.png

It also maintains project-local lock/mapping state such as:

  • petiglyph.lock
  • .petiglyph-build.lock

glyph-map.json maps source files to assigned codepoints. glyph-sample.txt contains the generated sample string.

Install, sample, and doctor

install-font:

  • builds the project
  • installs the .ttf into the current user font location
  • uses a project-prefixed installed family name by default
  • preserves project ownership through project_id and the Unicode registry

sample:

  • builds the project
  • performs a managed install
  • refreshes platform font state
  • prints the private-use sample string

doctor:

  • runs global health checks without a manifest
  • adds project-specific checks when a project is resolvable
  • can repair stale locks, orphan metadata, and missing registry assignment with --repair

uninstall-all-fonts removes managed petiglyph fonts and managed metadata for the current user.

Platform notes

Install roots:

  • Linux: ~/.local/share/fonts/petiglyph/
  • macOS: ~/Library/Fonts/ for installed TTFs, with managed metadata under ~/Library/Fonts/petiglyph/
  • Windows: %LOCALAPPDATA%/Microsoft/Windows/Fonts/petiglyph/

Clipboard backends used by the TUI:

  • Linux: wl-copy or xclip
  • macOS: pbcopy
  • Windows: PowerShell Set-Clipboard or clip.exe

After installing a font, fully quit and reopen terminal applications so they reload font state.

Debugging and tests

Useful docs:

Project docs:

Useful env vars:

  • PETIGLYPH_NO_FFMPEG_PROMPT=1
  • PETIGLYPH_TUI_DEBUG=1
  • PETIGLYPH_TUI_DEBUG_LOG=/path/to/log
  • PETIGLYPH_TUI_HTY_FULL_REPAINT=1

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

petiglyph-0.1.0.tar.gz (244.8 kB view details)

Uploaded Source

Built Distributions

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

petiglyph-0.1.0-py3-none-win_arm64.whl (3.3 MB view details)

Uploaded Python 3Windows ARM64

petiglyph-0.1.0-py3-none-win_amd64.whl (3.4 MB view details)

Uploaded Python 3Windows x86-64

petiglyph-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (3.5 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ x86-64

petiglyph-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (3.3 MB view details)

Uploaded Python 3manylinux: glibc 2.17+ ARM64

petiglyph-0.1.0-py3-none-macosx_11_0_arm64.whl (3.3 MB view details)

Uploaded Python 3macOS 11.0+ ARM64

petiglyph-0.1.0-py3-none-macosx_10_12_x86_64.whl (3.4 MB view details)

Uploaded Python 3macOS 10.12+ x86-64

File details

Details for the file petiglyph-0.1.0.tar.gz.

File metadata

  • Download URL: petiglyph-0.1.0.tar.gz
  • Upload date:
  • Size: 244.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for petiglyph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 460c1de1ee9204d0962ef443442659b17fbf74fa8822e6339a7ddf7b2ac8aa4b
MD5 85cfd632288d4a8604cfcdb99161dd3b
BLAKE2b-256 ebc1dd762d289eb9e824399c180fc2512eb667dbe15dd2ae46b21200831eed5b

See more details on using hashes here.

Provenance

The following attestation bundles were made for petiglyph-0.1.0.tar.gz:

Publisher: pypi-publish.yml on petipoua/petiglyph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file petiglyph-0.1.0-py3-none-win_arm64.whl.

File metadata

  • Download URL: petiglyph-0.1.0-py3-none-win_arm64.whl
  • Upload date:
  • Size: 3.3 MB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for petiglyph-0.1.0-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 e7eb3c99637063978965e4b9c87f835def4387b60c4c6903fc5b9c433fdd8072
MD5 80d17a3b4cf9f21f25fdedbc2fa21fc0
BLAKE2b-256 d1419bbe27b866f5d1949aaf072bbae1c6de8ba866a568e4d01dbf54545fc85d

See more details on using hashes here.

Provenance

The following attestation bundles were made for petiglyph-0.1.0-py3-none-win_arm64.whl:

Publisher: pypi-publish.yml on petipoua/petiglyph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file petiglyph-0.1.0-py3-none-win_amd64.whl.

File metadata

  • Download URL: petiglyph-0.1.0-py3-none-win_amd64.whl
  • Upload date:
  • Size: 3.4 MB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for petiglyph-0.1.0-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 326332f93fde435ce506de0387addccd222600c9e29ac8cc10a99162f9974cb2
MD5 c535e8a5dd5161e41b23a2c0dd99013e
BLAKE2b-256 d0579300eaf6f69874128d043446131bacf867e8edbe98f8d681c1433112800c

See more details on using hashes here.

Provenance

The following attestation bundles were made for petiglyph-0.1.0-py3-none-win_amd64.whl:

Publisher: pypi-publish.yml on petipoua/petiglyph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file petiglyph-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for petiglyph-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d51f2fc3e2ef5b13547873075bb909879ce3bedaa5b327db9fb99b6cf9b15cd6
MD5 0f546d3dd401a810878c831c56864cc0
BLAKE2b-256 9ca05dbe7c531d020253956b70766d272a44c8d5ba6e1648d472bbccd3ffb819

See more details on using hashes here.

Provenance

The following attestation bundles were made for petiglyph-0.1.0-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: pypi-publish.yml on petipoua/petiglyph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file petiglyph-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.

File metadata

File hashes

Hashes for petiglyph-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm Hash digest
SHA256 23f7b75e708763c5d434536802c934359ca8fc419f5aa6492be3f5e345d5be70
MD5 8c61b3177781c9fdaedc0a7900404f46
BLAKE2b-256 ebdec727254ebfe3a269b4c49c2394681da1f53519dd72932dbf7215144dd136

See more details on using hashes here.

Provenance

The following attestation bundles were made for petiglyph-0.1.0-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:

Publisher: pypi-publish.yml on petipoua/petiglyph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file petiglyph-0.1.0-py3-none-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for petiglyph-0.1.0-py3-none-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 b2c9c284107eba385b5c44102d7c75ea0d7aff6d8f9cfd56b50a7721b32cec0d
MD5 a1430305b79e4f8cb8e083cb307c30b4
BLAKE2b-256 54f1d6f6a16579526c997e67935dea858dcb5a8620d35f02e4f5e05b3aeddd16

See more details on using hashes here.

Provenance

The following attestation bundles were made for petiglyph-0.1.0-py3-none-macosx_11_0_arm64.whl:

Publisher: pypi-publish.yml on petipoua/petiglyph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file petiglyph-0.1.0-py3-none-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for petiglyph-0.1.0-py3-none-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 86e30bcd56fb742147c5ca4f946b36d98e4d3f2434368829282e60f1b4f9558f
MD5 818f4bcd9a698a8079a26cb7a2e4feef
BLAKE2b-256 5731df95b32b770cdac566c09c52084b00151a05d31bb16e09dcc4f249e3d68d

See more details on using hashes here.

Provenance

The following attestation bundles were made for petiglyph-0.1.0-py3-none-macosx_10_12_x86_64.whl:

Publisher: pypi-publish.yml on petipoua/petiglyph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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