Large images cause Claude API dimension limit error
Bug
When a user sends a photo larger than 2000px (common with modern phone cameras), the Claude API returns an error:
exceeds dimension limit for many-image requests
There is no image resizing in the media download pipeline.
Root cause
In messenger/telegram/media.py, download_media() saves the file as-is from Telegram without checking dimensions. Claude API has a 2000px max dimension limit for images.
Expected behavior
Images should be automatically downscaled to fit within the API limit before being sent to the LLM.
Suggested fix
After downloading a photo, check dimensions and resize if needed. On macOS, sips --resampleHeightWidthMax 2000 works natively. Cross-platform alternative: Pillow.
Fixed in v0.15.0. I added automatic image processing via Pillow — incoming images are resized to max 2000px and converted to WebP. Configurable via config.image (max_dimension, output_format, quality). Applied across all transports. Errors fall back to the original file.