Skip to content

Comments

feat: add image resize feature#1

Merged
kkdev92 merged 1 commit intomainfrom
feature/resize
Feb 2, 2026
Merged

feat: add image resize feature#1
kkdev92 merged 1 commit intomainfrom
feature/resize

Conversation

@kkdev92
Copy link
Owner

@kkdev92 kkdev92 commented Feb 2, 2026

Summary

Add automatic image resizing to reduce file size and optimize for AI chat.

  • New resize mode: fit (maintains aspect ratio, no upscaling)
  • Preset: ai-optimized (1200x1200 max for AI token optimization)
  • Configurable maxWidth/maxHeight (1-16384px range)

Changes

+1,295 lines / 12 files

Features

  • Image resize with fit mode using Sharp's inside fit strategy
  • ai-optimized preset reduces token consumption in AI assistants
  • Efficient single-pass Sharp pipeline

Quality

  • 431 tests passing
  • JSDoc documentation for resize behavior
  • Hardcoded values replaced with constants

Test plan

  • npm test - All 431 tests pass
  • npm run lint - No errors
  • Manual test: Paste large image with resize.mode: "fit" and resize.preset: "ai-optimized"
  • Verify image dimensions <= 1200x1200

🤖 Generated with Claude Code

Add automatic image resizing to reduce file size and optimize for AI chat.

Features:
- New resize mode: 'fit' (maintains aspect ratio, no upscaling)
- Preset: 'ai-optimized' (1200x1200 max for AI token optimization)
- Configurable maxWidth/maxHeight (1-16384px range)

Implementation:
- Efficient single-pass Sharp pipeline with toBuffer({ resolveWithObject: true })
- Comprehensive validation with clear error messages
- Warning when preset overrides manual settings

Quality:
- 431 tests passing (+2 for corrupted image handling)
- JSDoc documentation for resize behavior
- Constants used instead of hardcoded values

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@kkdev92 kkdev92 merged commit d73109b into main Feb 2, 2026
1 check passed
@kkdev92 kkdev92 deleted the feature/resize branch February 2, 2026 06:26
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