Generate an image of a repository, visualized as 1-pixel tall text.
This requires ImageMagick, if you want images instead of raw pixels.
This requires that the Python Pygments pygmentize
command is in your PATH.
If you don't have Pygments installed, just run:
pip install pygments
This also requires Ruby 2.0. (The language detection libs require it.)
Then, just check out this repo and install the Ruby dependencies with Bundler:
bundle
Simple example to render a repository at 1920x1080, 80-column lines, PNG output.
bundle exec bin/textpixels --repo /path/to/repository --out graphic.png
- --files FILES / --repo REPO
- --cols N
- --transparent / --alpha
- --solid / --no-alpha
- --style STYLE
- --finish PHASE
- --load FILE
- --save FILE
- --known / --skip-unknown
- --lines MAX
- --out IMAGEFILE
- --size WxH
- --crop DIMS
- --no-crop
- --raw
- --height N
- --long
- --fg COLOR / --default-fg COLOR
- --bg COLOR / --default-bg COLOR
- --lang-as PROPS
What files to process. If neither option is given, filenames will be read from
stdin. A directory is treated as a git repository on which git ls-files
will
be called to find filenames.
Number of columns per line of text. Default: 80.
Make the default background transparent.
Don't use transparency. (Default is to not use transparency.)
Name of a Pygments style to use for colorization. Try the Pygments demo to see them.
The special value NONE will prevent any style from being used. Then you probably also want to use --lang-as for language-based colors, or --fg and --bg for two-color output.
Only really useful with --save.
Stop after the named phase. Mainly for debugging, but also for preprocessing a set of files to colorize them in several different ways.
Load a file previously --save'd.
Save the results of processing in the named file. Mostly for debugging. But can be used for caching intermediate stages for multiple uses. E.g.:
# save the results of parsing all the files into HTML
bundle exec bin/textpixels --repo some/large/repo --finish htmlize --save HTML
# generate output with two different styles
bundle exec bin/textpixels --load HTML --style fruity --out fruity.png
bundle exec bin/textpixels --load HTML --style monokai --out monokai.png
Ignore files with unknown filetype.
Only render the first MAX lines of output.
Output to this file. Can use anything valid as the target of an ImageMagick command. See the explanation of Output Filename in the ImageMagick documentation.
Height of an image strip. Default: 1080.
Size of the final crop for the output image. Default: 1920x+0+0. See the ImageMagick description of -crop
Prevents the final image crop.
Sets --no-crop and makes the height as tall as needed to fit all file lines.
Sets --height to H and --crop to Wx+0+0.
Prints raw RGB or RGBA (depending on --transparency) pixels.
Default foreground color. Must be specified as RRGGBB or RRGGBBAA. (No leading hash.)
Default background color. Must be specified as RRGGBB or RRGGBBAA. (No leading hash.)
Use the GitHub language color as the specified comma-separated CSS properties.
Only color
and background-color
have any effect.
E.g.:
# generate a block of color for each file
bundle exec bin/textpixels --repo somerepo --style NONE --lang-as color,background-color