feat(render): --extract-text flag for hybrid output (tiles + text.md)#106
Open
aafaq-rashid-comprinno wants to merge 2 commits into
Open
feat(render): --extract-text flag for hybrid output (tiles + text.md)#106aafaq-rashid-comprinno wants to merge 2 commits into
aafaq-rashid-comprinno wants to merge 2 commits into
Conversation
Adds an opt-in text extraction mode to pixelshot that saves a text.md file alongside the screenshot tiles. Uses CDP Runtime.evaluate to grab document.body.innerText after the page is rendered — zero-cost since the DOM is already open. Usage: pixelshot https://example.com -o ./tiles --extract-text Output: tiles/example.com.png.tiles/ ├── tile_0000.jpg # visual tile (existing) ├── text.md # page text as markdown (new) └── tiles.json # manifest This enables hybrid workflows where LLMs receive text for text-heavy paragraphs (cheap tokens) and images only for charts/tables/diagrams (expensive vision tokens). Addresses StarTrail-org#93.
|
@aafaq-rashid-comprinno is attempting to deploy a commit to the andylizf's projects Team on Vercel. A member of the Team first needs to authorize it. |
Verifies text.md is created with page content when extract_text=True, and not created when the flag is off (default).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses #93.
Problem
Passing full screenshot tiles to LLMs costs many vision tokens. For text-heavy pages, extracting the text alongside the visual tiles lets users choose the cheaper representation when no charts/tables are present.
Solution
New
--extract-textflag forpixelshotthat extractsdocument.body.innerTextvia CDP after the page is rendered and saves it astext.mdin the tile directory.Output:
Design decisions
innerTextis a single CDP call--extract-textis off by default)Tested