Skip to content

Fix/compression#364

Draft
rsalaks2 wants to merge 9 commits intomainfrom
fix/compression
Draft

Fix/compression#364
rsalaks2 wants to merge 9 commits intomainfrom
fix/compression

Conversation

@rsalaks2
Copy link

@rsalaks2 rsalaks2 commented Mar 9, 2026

Before there was no compression for images at all. For anthropic, at least.

reinis added 8 commits March 9, 2026 19:42
Controlled by screenshot_quality parameter or ANTHROPIC_SCREENSHOT_QUALITY
env var. Default None (lossless PNG). Set to 1-95 for JPEG compression.

Made-with: Cursor
ContentResult.to_content_blocks() was hardcoding mimeType="image/png"
even when the screenshot had been JPEG-compressed, causing Anthropic API
to reject the tool result with a 400 error.

Made-with: Cursor
base64_to_content_block() was hardcoding media_type="image/png" and the
call site was dropping content.mimeType from MCP responses. This caused
Anthropic API to reject JPEG-compressed screenshots with a 400 error.

Made-with: Cursor
Remove /tmp/compression_log.txt writes, _log_message_sizes function,
and /tmp/compression_errors.txt writes that were used during local
testing of the JPEG compression feature.

Made-with: Cursor
Copy link
Contributor

@dylanbowman314 dylanbowman314 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add unit tests, otherwise lgetm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants