Skip to main content

Convert source code to cross stitch patterns

Project description

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

See examples and completed cross stitch patterns here!



Available via pip

pip install pyxstitch


  • Clone the source repo and…
python install


pip install .


pip install -e .

os packaging

os link
arch linux aur


to run

pyxstitch --file


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 --style monokai


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

pyxstitch --file --output image.png

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

cat | 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.


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

cat | pyxstich

produces no highlighting but

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


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


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


sets the default page height (600 default)

--kv page_height=500


sets the default page width (1000 default)

--kv page_width=900


page padding (margins) which defaults to 50

--kv page_pad=100


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

--kv page_no_index=1


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


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


there are example source code files and corresponding output pngs in the examples folder

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pyxstitch, version 1.9.0
Filename, size File type Python version Upload date Hashes
Filename, size pyxstitch-1.9.0.tar.gz (35.9 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page