Structs§
- Dimension
Result - Optimization
Report - Optimize
Result - Persistence
- Process
Config - All tuneable knobs for the pipeline.
- Process
Config Builder - Process
Result - Savings
Report - Squeezer
Stats - Token
Estimate - Token
Savings Table - Full token savings report for a before/after dimension pair across all models.
Enums§
- ImageOp
- Atomic image operations for the Sandbox mode.
- Output
Format - Output encoding format.
- Process
Mode - Vision
Model - Supported vision model families with their patch pricing.
Functions§
- binarize
- calculate_
optimal_ dimensions - Snap W×H to tile boundaries using default tile size (512).
- calculate_
optimal_ dimensions_ with - Snap W×H to tile boundaries using a custom tile size.
- crop_
padding - Remove solid-color borders using corner sampling + configurable tolerance.
- decode_
base64_ image - detect_
ocr_ mode - encode_
image_ base64 - encode_
to_ bytes - Encode image to raw bytes using the configured output format.
- estimate_
tokens - Estimate LLM vision tokens for an image of given dimensions.
- fit_
within - Scale dimensions to fit within
max_sidewhile preserving aspect ratio. - fit_
within_ pixels - Scale dimensions to fit within both a max-side limit and a total-pixel limit.
- optimal_
send_ dimensions - Compute the optimal dimensions to send to a given model to minimize tiles.
- optimize_
image - MCP entry point: base64 in → base64 JPEG out + savings report.
- process
- Full pipeline: [crop] → tile-snap resize → [OCR binarize].
Pass
input_bytes = 0if unknown (omits file-size from report). - process_
with_ operations - Execute a sequence of operations on an image.
- token_
savings_ table