Skip to main content

pyxstitch is an application (and associated library/components) that takes source code files and produces syntax-highlighted patterns for cross stitching.

https://img.shields.io/pypi/v/pyxstitch https://img.shields.io/github/workflow/status/enckse/pyxstitch/build

install

pip

Available via pip

pip install pyxstitch

source

  • Clone the source repo and…

python setup.py install

or

pip install .

or

pip install -e .

usage

to run

pyxstitch --file program.py

styling

to see actual highlight colors on the pattern use --theme light-dmc and if using a high-contrast style you may want to toggle --theme dark (or --theme dark-dmc for colors on dark backgrounds).

the coloring styles are available as part of the pygments project but can be passed like so

pyxstitch --file program.py --style monokai

output

by default a png file is created matching the source code file name (e.g. hello.py -> hello.png), to change this

pyxstitch --file program.py --output image.png

or just pass a file type and type/cat into pyxstitch

cat test.py | pyxstitch --file .py --output myimage.png

by default, pyxstitch will attempt to create multiple pages for easier reading of large patterns, this can be modified via --multipage.

syntax/lexer

by default pyxstitch will use just a text lexer (no syntax) if piped/stdin is used, that can be changed, so

cat test.py | pyxstich

produces no highlighting but

cat test.py | pyxstitch --file .py
# or
cat test.py | pyxstitch --lexer autodetect
# or tell it which pygments lexer to use
cat test.py | pyxstitch --lexer python

fonts

to select a different font (from available)

pyxstitch --font <type-charset-size>

floss colors

colors can be remapped or disabled, e.g. to disable a color, set it to map to empty

pyxstitch --file test.c --map 000000=

or to map one color to another

pyxstitch --file test.c --map 000000=ffffff

advanced

some configuration options are available via the --kv input settings. Alternatively set these in a $HOME/.pyxstitch.config file to use different defaults always (unless a --kv is passed) or pass a --config and specify a different file than the one in $HOME

vim $HOME/.pyxstitch.config
---
# comments will be ignored
page_height=400
page_width=300

height

sets the default page height (600 default)

--kv page_height=500

width

sets the default page width (1000 default)

--kv page_width=900

padding

page padding (margins) which defaults to 50

--kv page_pad=100

index

on multipage will produce an html file (by default of 0) to group images into a pattern

--kv page_no_index=1

legend

default is 0, will print the legend to console (instead of to output image) when set to 1

--kv page_legend=1

height offset

default is 0, will change legend height placement on an image

--kv legend_hoff=10

width offset

default is 0, will change legend width placement on an image

--kv legend_woff=-5

font size

to adjust the font scaling for the legend when in the output

--kv page_font_size=100

zoom

you can zoom the pattern in by specifying the vertical and/or horizontal zoom start/end

pyxstitch --hszoom 20 --hezoom 30 --vszoom 10 --vezoom 40

will zoom the output to horizontal grid position 20 to 30 and vertical grid position 10 to 40

Metadata

Release files for pyxstitch 1.11.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyxstitch 1.11.1
File Size Uploaded
pyxstitch-1.11.1.tar.gz 57.3 kB Details

Release files / pyxstitch-1.11.1.tar.gz

Download URL pyxstitch-1.11.1.tar.gz
Size 57.3 kB
Tags Source
SHA-256 checksum
How to use checksums
6cc84cb3c2d0053d69337432c35c91eb78f9650945c76e332b5787208ba0d08f
BLAKE2b-256 checksum
How to use checksums
4e8e4b1b10519a156d8b93079ed36a494f4447109946488fb66bdf228042739b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.3 readme-renderer/29.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.2 importlib-metadata/0.0.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.5

Release history Release notifications | RSS feed

This release

1.11.1 This release

1 release file

1.11.0

1 release file

1.10.1

1 release file

1.10.0

2 release files

1.9.4

2 release files

1.9.3

2 release files

1.9.2

1 release file

1.9.1

1 release file

1.9.0

1 release file

1.8.1

1 release file

1.8.0

1 release file

1.7.10

1 release file

1.7.9

1 release file

1.7.8

1 release file

1.7.7

1 release file

1.7.6

1 release file

1.7.5

1 release file

1.7.4

1 release file

1.7.3

1 release file

1.7.2

2 release files

1.6.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page