GitHub - YogiSotho/dense-image-gen: Render text files into dense monospace PNG walls for token-efficient vision-model reading (~2.8x compression) · GitHub
/" data-turbo-transient="true" />
Skip to content
Search or jump to...
Search code, repositories, users, issues, pull requests...
-->
Search
Clear
Search syntax tips
Provide feedback
--><br>We read every piece of feedback, and take your input very seriously.
Include my email address so I can be contacted
Cancel
Submit feedback
Saved searches
Use saved searches to filter your results more quickly
-->
Name
Query
To see all available qualifiers, see our documentation.
Cancel
Create saved search
Sign in
/;ref_cta:Sign up;ref_loc:header logged out"}"<br>Sign up
Appearance settings
Resetting focus
You signed in with another tab or window. Reload to refresh your session.<br>You signed out in another tab or window. Reload to refresh your session.<br>You switched accounts on another tab or window. Reload to refresh your session.
Dismiss alert
{{ message }}
YogiSotho
dense-image-gen
Public
Notifications<br>You must be signed in to change notification settings
Fork
Star
main
BranchesTags
Go to file
CodeOpen more actions menu
Folders and files<br>NameNameLast commit message<br>Last commit date<br>Latest commit
History<br>3 Commits<br>3 Commits
.gitignore
.gitignore
LICENSE
LICENSE
README.md
README.md
denseimg.py
denseimg.py
example.png
example.png
View all files
Repository files navigation
I miss you.
denseimg — dense text-as-image generator
Renders text files into a tightly packed monospace PNG (a "wall of text" image)<br>so a vision model can OCR the content at ~2.5–3× fewer tokens than raw text.<br>In the default flow mode, original newlines become a ⏎ glyph and the text<br>re-wraps into a continuous block for maximum density; a banner line at the top<br>tells the reading model how to interpret it.
This README, rendered by the tool itself (example.png, 2.3× — longer inputs reach ~2.8×):
Requirements
Python 3 + Pillow (pip install pillow). Uses Cascadia Mono by default<br>(ships with Windows 11); falls back gracefully if a font lacks the ⏎ glyph.
Usage
# one file<br>python denseimg.py SKILL.md -o skill.png --title "MAGIC SKILL"
# pack several files into one image (FILE: separators added automatically)<br>python denseimg.py magic\SKILL.md moonshot\SKILL.md dna\SKILL.md -o pack.png --title "WARDEN SKILLS"
# preserve original line layout instead of flowing (code, tables)<br>python denseimg.py notes.txt -o notes.png --mode lines
# denser (smaller font) — verify legibility before relying on it<br>python denseimg.py big.md -o big.png --size 9
Content longer than one page paginates to name-p1.png, name-p2.png, …<br>The tool prints a token report: image tokens vs. estimated text tokens.
Options
Flag<br>Default<br>Meaning
--width<br>1568<br>image width (1568 = Claude vision long-edge cap; wider gets downscaled)
--max-height<br>1568<br>page height cap before paginating
--size<br>10<br>font pixel size (9 = ~20% denser, slightly blurrier)
--font<br>CascadiaMono.ttf<br>any monospace TTF name/path
--mode<br>flow<br>flow = max density, lines = keep layout
--leading<br>auto<br>line-spacing tweak in px (negative = tighter)
--keep-ws<br>off<br>keep runs of spaces in flow mode (indentation)
--glyph<br>newline marker (auto-falls back to ¶ if font lacks it)
--title<br>filenames<br>banner title
--no-preamble<br>off<br>drop the OCR-instruction banner
Numbers (measured)
1 file: magic/SKILL.md (13.7k chars) → 1568×591, ~1,240 image tokens vs ~3,400 text tokens (2.8× )
3 files: magic+moonshot+dna (29.8k chars) → 1568×1273, ~2,660 image tokens vs ~7,500 text tokens (2.8× )
Rule of thumb at defaults: ~11 chars per image token, ~40k chars per full 1568×1568 page.
About
Render text files into dense monospace PNG walls for token-efficient vision-model reading (~2.8x compression)
Resources
Readme
License
MIT license
Uh oh!
There was an error while loading. Please reload this page.
Activity
Stars
stars
Watchers
watching
Forks
forks
Report repository
Releases
No releases published
Packages
Uh oh!
There was an error while loading. Please reload this page.
Contributors
Uh oh!
There was an error while loading. Please reload this page.
Languages
Python<br>100.0%
You can’t perform that action at this time.