Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves image compression for LLM interactions by switching from PNG to JPEG format with quality 85, and increasing the maximum dimension from 768px to 1024px. These changes reduce image sizes significantly, allowing ~85 images per conversation instead of 12.
Changes:
- Extracted image processing logic into a new
prepare_image_for_llmhelper function - Changed image encoding from PNG to JPEG with 85% quality
- Updated dimension constraints from 768px max width to 1024px max dimension (handles both width and height)
- Added JPEG feature to the
imagecrate dependency
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| crates/goose-mcp/src/developer/rmcp_developer.rs | Refactored image processing into shared helper function, switched to JPEG compression, and improved dimension scaling logic |
| crates/goose-mcp/Cargo.toml | Added "jpeg" feature to image crate dependency |
Comment on lines
+1259
to
+1264
| image::codecs::jpeg::JpegEncoder::new_with_quality(&mut cursor, 85) | ||
| .encode( | ||
| rgb_image.as_raw(), | ||
| img_width, | ||
| img_height, | ||
| image::ColorType::Rgb8, |
There was a problem hiding this comment.
Missing import statement for the image crate. The code uses image::codecs::jpeg::JpegEncoder and image::ColorType::Rgb8 but there's no use image::... import at the top of the file. Add use image; to the imports section (around line 1-30) to fix the compilation error.
This was referenced Jan 29, 2026
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.
Summary
Reduces the size of the images we send to the LLM. Should allow us to have 85 images in a conversation instead of the current 12 or less