Skip to content

Compress oversized images client-side in AI chat#1456

Draft
N2D4 wants to merge 1 commit into
devfrom
devin/1779310805-compress-chat-images
Draft

Compress oversized images client-side in AI chat#1456
N2D4 wants to merge 1 commit into
devfrom
devin/1779310805-compress-chat-images

Conversation

@N2D4
Copy link
Copy Markdown
Contributor

@N2D4 N2D4 commented May 20, 2026

Compress images that exceed the 3MB limit on the client using canvas instead of rejecting them with an error toast.

  • New compress-image.ts: resizes to max 2048px, encodes as JPEG with decreasing quality until within ~1.5MB
  • ImageAttachmentAdapter.add now compresses oversized files instead of throwing
  • Removed pre-rejection logic from ComposerAttachmentsAddButton

Link to Devin session: https://app.devin.ai/sessions/f6bde30365774f2183da9226b8d0141a
Requested by: @N2D4

Instead of rejecting images that exceed the 3MB limit with an error
toast, compress them on the client using canvas before attaching.

- Add compress-image.ts utility: resizes to max 2048px, encodes as
  JPEG with decreasing quality until the result fits within ~1.5MB.
- Update ImageAttachmentAdapter to compress in the add step instead
  of throwing on oversized files.
- Remove pre-rejection logic from ComposerAttachmentsAddButton so
  all selected images flow through the adapter (which compresses
  them as needed).

Co-Authored-By: Konstantin Wohlwend <n2d4xc@gmail.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@vercel
Copy link
Copy Markdown

vercel Bot commented May 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
stack-auth-hosted-components Ready Ready Preview, Comment May 20, 2026 9:08pm
stack-auth-mcp Ready Ready Preview, Comment May 20, 2026 9:08pm
stack-auth-skills Ready Ready Preview, Comment May 20, 2026 9:08pm
stack-backend Ready Ready Preview, Comment May 20, 2026 9:08pm
stack-dashboard Ready Ready Preview, Comment May 20, 2026 9:08pm
stack-demo Ready Ready Preview, Comment May 20, 2026 9:08pm
stack-docs Ready Ready Preview, Comment May 20, 2026 9:08pm
stack-preview-backend Ready Ready Preview, Comment May 20, 2026 9:08pm
stack-preview-dashboard Ready Ready Preview, Comment May 20, 2026 9:08pm

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 20, 2026

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2c6db494-02e6-41b0-892c-0fd4327bd9c6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch devin/1779310805-compress-chat-images

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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.

1 participant