Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Guidance for building and deploying AI solutions on Azure using Azure AI services and Copilot for Azure
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/sdk/azure-ai-vision-imageanalysis-py.md
1# Azure AI Vision Image Analysis — Python SDK Quick Reference23> Condensed from **azure-ai-vision-imageanalysis-py**. Full patterns (dense captions, smart crops, people detection)4> in the **azure-ai-vision-imageanalysis-py** plugin skill if installed.56## Install7```bash8pip install azure-ai-vision-imageanalysis9```1011## Quick Start12```python13from azure.ai.vision.imageanalysis import ImageAnalysisClient14from azure.ai.vision.imageanalysis.models import VisualFeatures15client = ImageAnalysisClient(endpoint=endpoint, credential=credential)16```1718## Non-Obvious Patterns19- `analyze_from_url(image_url=..., visual_features=[...])` for URL; `analyze(image_data=bytes)` for file20- VisualFeatures enum: `CAPTION`, `DENSE_CAPTIONS`, `TAGS`, `OBJECTS`, `READ`, `PEOPLE`, `SMART_CROPS`21- Async: `from azure.ai.vision.imageanalysis.aio import ImageAnalysisClient`2223## Best Practices241. Select only needed visual features to optimize latency and cost252. Use async client for high-throughput scenarios263. Handle HttpResponseError for invalid images or auth issues274. Enable `gender_neutral_caption` for inclusive descriptions285. Specify `language` for localized captions296. Use `smart_crops_aspect_ratios` matching your thumbnail requirements307. Cache results when analyzing the same image multiple times31