Clipboard Image Paste
PressCtrl+V to paste an image from your clipboard.
Supported Platforms
macOS- Uses
pngpastecommand (if available) - Falls back to AppleScript (
osascript) for PNG extraction - Automatically converts clipboard image to PNG format
- Checks
wl-paste(Wayland) - Falls back to
xclip(X11) - Falls back to
xsel(X11)
- Currently not supported for direct clipboard image paste
- Use file paths instead (see below)
macOS Clipboard Tools
For best results on macOS, installpngpaste:
pngpaste, loaf uses AppleScript which is slower and less reliable.
File Path Attachments
Paste a file path and pressCtrl+V to attach the image:
- Resolve the path (supports
~for home directory) - Validate the file exists and is a supported image type
- Check the file size (max 8 MB)
- Load and encode the image as a base64 data URL
- Attach it to your current message
Supported Image Formats
| Extension | MIME Type |
|---|---|
.png | image/png |
.jpg | image/jpeg |
.jpeg | image/jpeg |
.webp | image/webp |
.gif | image/gif |
Image Limits
File Size
- Maximum: 8 MB per image
- Larger images will be rejected with an error message
Attachment Count
- Maximum: 4 images per message
- After reaching the limit, you must send the message or use
/clear
Image Workflow
1. Attach Image
PressCtrl+V with an image in clipboard or a file path:
2. Add Context
Type your prompt after the image placeholder:3. Send Message
PressEnter to send. The model receives both the image and text.
Multiple Images
Attach multiple images before sending:Image Display
Images appear in the conversation transcript:Technical Details
Data URL Encoding
Images are converted to base64 data URLs for sending to the model:- Stored in session history
- Sent to any model provider
- Preserved when resuming sessions
Token Cost
Images consume tokens based on size and resolution. loaf estimates:- ~850 tokens per image (approximate)
- Added to context window calculation
- Displayed in token budget counter
src/index.tsx:293:
Image Storage
When you attach an image:src/chat-types.ts
Path Resolution
loaf resolves image paths with:~/→ User home directoryfile://→ Decoded from URI format- Relative paths → Resolved from current working directory
- Quoted paths → Quotes stripped automatically
src/core/images.ts:210-238
Keyboard Shortcut
The attach shortcut adapts to your platform:- macOS, Linux, Windows:
Ctrl+V
Error Messages
Common Errors
File not foundRPC Mode
When using loaf in RPC mode, images can be sent via:File Path
Data URL
src/core/images.ts:16-55
Examples
Debugging UI Issues
Code Review
Design Feedback
Image attachments work best with vision-capable models like GPT-4o, Claude 3.5 Sonnet, and Gemini Pro Vision.