Skip to content

Conversation

@DOsinga
Copy link
Collaborator

@DOsinga DOsinga commented Jan 27, 2026

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

Copilot AI review requested due to automatic review settings January 27, 2026 18:19
Copy link
Collaborator

@zanesq zanesq left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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_llm helper 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 image crate 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,
Copy link

Copilot AI Jan 27, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
@DOsinga DOsinga merged commit 2a4ed84 into main Jan 27, 2026
20 checks passed
@DOsinga DOsinga deleted the better-image-compression branch January 27, 2026 22:08
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