The BlueQ system now supports transferring images over the Bluetooth mesh network! Images are encoded using Base64 and sent in chunks to ensure reliable delivery over Bluetooth.
- Image Encoding: Images are Base64 encoded for safe transmission
- Chunking: Large images are split into manageable chunks (default 800 bytes each)
- Message Types:
IMG_START: Announces the start of an image transferIMG_CHUNK: Contains a piece of the Base64-encoded imageIMG_END: Signals completion and includes a checksum for verification
[ID:sender:recipient:IMG_START] filename.ext|chunk_count|file_size|checksum
[ID:sender:recipient:IMG_CHUNK] chunk_index|base64_data
[ID:sender:recipient:IMG_END] filename.ext|checksum
✅ Automatic chunking for images of any size
✅ Integrity verification using MD5 checksums
✅ Progress tracking during transfer
✅ Error handling for incomplete transfers
✅ Web interface integration - images sent via web are also transmitted over Bluetooth
✅ Duplicate detection to prevent message duplication
- Open the BlueQ web app
- Select a contact
- Click the image upload button (📸)
- Select your image file (PNG or JPEG, max 5MB)
- The image will be sent via the web interface AND the Bluetooth mesh
# Send image via Bluetooth
curl -X POST http://localhost:5000/api/bluetooth/send_image \
-H "Content-Type: application/json" \
-d '{
"user_id": "user123",
"destination": "RecipientName",
"image_path": "/path/to/image.jpg"
}'If you're using the Python Bluetooth client directly:
from bluetooth_image_protocol import BluetoothImageTransfer
# Initialize
transfer = BluetoothImageTransfer()
# Prepare image for sending
chunks = transfer.prepare_image_for_transfer(
"photo.jpg",
"YourName",
"RecipientName"
)
# Send each chunk over your Bluetooth socket
for chunk in chunks:
socket.send(f"{chunk}\n".encode())| Image Size | Estimated Transfer Time* | Recommended Use |
|---|---|---|
| < 100KB | 5-15 seconds | ✅ Profile pictures, small photos |
| 100KB-500KB | 30-90 seconds | |
| 500KB-1MB | 2-5 minutes | |
| > 1MB | 5+ minutes | ❌ Not recommended over Bluetooth |
*Transfer times depend on Bluetooth connection quality and mesh network topology
- PNG - Recommended for graphics with transparency
- JPEG/JPG - Recommended for photos (naturally compressed)
- GIF - Supported but animated GIFs will be static
- WEBP - Supported in web interface
- Compress images before sending (aim for < 200KB)
- Use JPEG for photos (better compression than PNG)
- Send during stable connections (avoid during mesh topology changes)
- Send one image at a time (don't queue multiple large transfers)
# Using ImageMagick (Linux/Mac)
convert original.jpg -quality 80 -resize 800x600 compressed.jpg
# Using Python (PIL)
from PIL import Image
img = Image.open('original.jpg')
img = img.resize((800, 600), Image.Lanczos)
img.save('compressed.jpg', 'JPEG', quality=80)- Check that both sender and receiver are connected to the mesh
- Verify the image file exists and is readable
- Try with a smaller image first
- Check Bluetooth connection stability
- The system will automatically detect missing chunks
- Transfers will timeout and cleanup after failed attempts
- Check the console logs for specific error messages
- Large images take time - this is normal for Bluetooth
- Reduce image size for faster transfers
- Ensure stable mesh connections
- Encoding: Base64 (RFC 4648)
- Checksum: MD5 hash (8 characters)
- Max chunk size: 800 bytes (configurable)
- Supported file size: Up to 5MB (web interface limit)
- Checksum verification prevents corruption
- Missing chunk detection and reporting
- Automatic cleanup of incomplete transfers
- Graceful fallback for protocol errors
- Images are transmitted in Base64 (not encrypted)
- Consider the privacy implications of mesh networking
- Images are stored locally on receiving devices
- No authentication is performed on image transfers
The image transfer feature is fully integrated with the existing BlueQ web interface:
- Dual Transmission: Images sent via web are also transmitted over Bluetooth
- Unified Storage: All images (web and Bluetooth) are stored in the same location
- Message History: Bluetooth-received images appear in chat history
- Progress Indication: Transfer progress is logged in the console
Use the included test script to verify functionality:
# Test with a specific image
python3 test_image_transfer.py path/to/your/image.jpg
# Test with auto-generated image (requires PIL)
python3 test_image_transfer.pyPotential improvements for future versions:
- 📱 Compression: Automatic image compression before transfer
- 🔐 Encryption: End-to-end encryption for sensitive images
- 📊 Progress UI: Real-time transfer progress in web interface
- 🔄 Retry Logic: Automatic retry of failed chunks
- 📈 Statistics: Transfer speed and success rate tracking
- 🎯 Smart Routing: Choose optimal mesh path for large transfers
This feature transforms BlueQ from a text-only mesh messenger into a multimedia communication platform, all without requiring internet connectivity!