PNG trick cuts Claude API costs 90% by sending text as images instead of tokens

An open-source tool called pxpipe, which gained traction on GitHub in late December 2025, reduces AI API costs by converting large text blocks into PNG images before sending them to multimodal models like Claude. Because image pricing is based on pixel dimensions rather than character count, dense text rendered as a compact image consumes far fewer tokens — roughly 2,700 image tokens versus 25,000 text tokens for the same 48,000-character block. In one documented test, the same Claude Code session cost $4.51 with image-encoded context compared to $42.21 when sent as plain text. The technique works because image tokens can encode more information per unit than text tokens, with research suggesting a single image token can represent the equivalent of about 10 text tokens. Improved accuracy of vision encoders in reading small, dense type has made this approach viable for production use cases such as long-context pipelines and AI agents.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in