|
|
Claude Vision API - Analyzing Images with Claude
Author: Venkata Sudhakar
Claude can analyze images sent as part of the messages array, making it a powerful tool for visual commerce applications. For ShopMax India, vision capabilities power features like product damage detection in return requests, counterfeit identification by comparing product images against catalog photos, and auto-generating alt text and descriptions from product images uploaded by sellers. Claude supports JPEG, PNG, GIF, and WebP formats up to 20MB per image.
Images are passed in the content array alongside text using the image content block type. The source field specifies how the image is provided: type base64 with media_type and data for inline images, or type url for publicly accessible image URLs. Multiple images can be included in a single message, and Claude can reason across all of them together. The image tokens are counted separately and depend on image dimensions - a 1024x1024 image costs approximately 1600 tokens.
The following example shows ShopMax India using Claude vision to analyze product images - detecting damage in return requests and generating catalog descriptions from seller-uploaded photos:
It gives the following output,
Return Analysis - ORD-MUM-8821:
1. Damage visible: Cracked bottom-left corner of screen with visible LCD bleed.
2. Approve return: Yes - clear manufacturing defect or transit damage.
3. Action: Approve full refund, flag courier for transit damage report, arrange pickup.
Generated Catalog Description:
Bring home a stunning cinematic experience with the Samsung 55-inch 4K QLED TV,
featuring vibrant quantum dot colors and HDR precision that makes every scene
come alive in your Mumbai or Bangalore living room.
Its sleek slim-bezel design and smart Tizen OS with built-in OTT apps make
it the perfect centrepiece for modern Indian households.
For ShopMax India production vision pipelines, resize images to 1024px on the longest side before sending to Claude - this cuts token costs by up to 75% with minimal quality loss for damage detection and description tasks. Use URL-based images instead of base64 when the images are already hosted on your CDN, as this avoids base64 encoding overhead in your API payload. For high-volume return processing (1000+ images per day), combine Claude vision with the Batch API to reduce costs by 50% and process images asynchronously. Always validate the media_type matches the actual file format before sending - a mislabeled image type causes a 400 error from the API.
|
|