[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-d17309d3-49a1-4693-852c-2d1578335758":3,"$fYaofkbXLatlIt0JUUtsJ4hvL5EH_6DUcLj_WaRq0Xlw":43},{"id":4,"title":5,"description":6,"categoryId":7,"moduleId":8,"tags":9,"prompt":10,"icon":11,"source":12,"sourceUrl":13,"authorId":14,"authorName":15,"isPublic":16,"stars":17,"runs":18,"createdAt":19,"updatedAt":19,"module":20,"category":27,"packages":34},"d17309d3-49a1-4693-852c-2d1578335758","azure-ai-vision-imageanalysis-py","Azure AI视觉图像分析SDK，用于字幕、标签、物体、OCR、人物检测和智能裁剪。用于计算机视觉和图像理解任务。","cat_coding_devops","mod_coding","sickn33,coding","---\nname: azure-ai-vision-imageanalysis-py\ndescription: Azure AI Vision Image Analysis SDK for captions, tags, objects, OCR, people detection, and smart cropping. Use for computer vision and image understanding tasks.\nrisk: unknown\nsource: community\ndate_added: '2026-02-27'\n---\n\n# Azure AI Vision Image Analysis SDK for Python\n\nClient library for Azure AI Vision 4.0 image analysis including captions, tags, objects, OCR, and more.\n\n## Installation\n\n```bash\npip install azure-ai-vision-imageanalysis\n```\n\n## Environment Variables\n\n```bash\nVISION_ENDPOINT=https:\u002F\u002F\u003Cresource>.cognitiveservices.azure.com\nVISION_KEY=\u003Cyour-api-key>  # If using API key\n```\n\n## Authentication\n\n### API Key\n\n```python\nimport os\nfrom azure.ai.vision.imageanalysis import ImageAnalysisClient\nfrom azure.core.credentials import AzureKeyCredential\n\nendpoint = os.environ[\"VISION_ENDPOINT\"]\nkey = os.environ[\"VISION_KEY\"]\n\nclient = ImageAnalysisClient(\n    endpoint=endpoint,\n    credential=AzureKeyCredential(key)\n)\n```\n\n### Entra ID (Recommended)\n\n```python\nfrom azure.ai.vision.imageanalysis import ImageAnalysisClient\nfrom azure.identity import DefaultAzureCredential\n\nclient = ImageAnalysisClient(\n    endpoint=os.environ[\"VISION_ENDPOINT\"],\n    credential=DefaultAzureCredential()\n)\n```\n\n## Analyze Image from URL\n\n```python\nfrom azure.ai.vision.imageanalysis.models import VisualFeatures\n\nimage_url = \"https:\u002F\u002Fexample.com\u002Fimage.jpg\"\n\nresult = client.analyze_from_url(\n    image_url=image_url,\n    visual_features=[\n        VisualFeatures.CAPTION,\n        VisualFeatures.TAGS,\n        VisualFeatures.OBJECTS,\n        VisualFeatures.READ,\n        VisualFeatures.PEOPLE,\n        VisualFeatures.SMART_CROPS,\n        VisualFeatures.DENSE_CAPTIONS\n    ],\n    gender_neutral_caption=True,\n    language=\"en\"\n)\n```\n\n## Analyze Image from File\n\n```python\nwith open(\"image.jpg\", \"rb\") as f:\n    image_data = f.read()\n\nresult = client.analyze(\n    image_data=image_data,\n    visual_features=[VisualFeatures.CAPTION, VisualFeatures.TAGS]\n)\n```\n\n## Image Caption\n\n```python\nresult = client.analyze_from_url(\n    image_url=image_url,\n    visual_features=[VisualFeatures.CAPTION],\n    gender_neutral_caption=True\n)\n\nif result.caption:\n    print(f\"Caption: {result.caption.text}\")\n    print(f\"Confidence: {result.caption.confidence:.2f}\")\n```\n\n## Dense Captions (Multiple Regions)\n\n```python\nresult = client.analyze_from_url(\n    image_url=image_url,\n    visual_features=[VisualFeatures.DENSE_CAPTIONS]\n)\n\nif result.dense_captions:\n    for caption in result.dense_captions.list:\n        print(f\"Caption: {caption.text}\")\n        print(f\"  Confidence: {caption.confidence:.2f}\")\n        print(f\"  Bounding box: {caption.bounding_box}\")\n```\n\n## Tags\n\n```python\nresult = client.analyze_from_url(\n    image_url=image_url,\n    visual_features=[VisualFeatures.TAGS]\n)\n\nif result.tags:\n    for tag in result.tags.list:\n        print(f\"Tag: {tag.name} (confidence: {tag.confidence:.2f})\")\n```\n\n## Object Detection\n\n```python\nresult = client.analyze_from_url(\n    image_url=image_url,\n    visual_features=[VisualFeatures.OBJECTS]\n)\n\nif result.objects:\n    for obj in result.objects.list:\n        print(f\"Object: {obj.tags[0].name}\")\n        print(f\"  Confidence: {obj.tags[0].confidence:.2f}\")\n        box = obj.bounding_box\n        print(f\"  Bounding box: x={box.x}, y={box.y}, w={box.width}, h={box.height}\")\n```\n\n## OCR (Text Extraction)\n\n```python\nresult = client.analyze_from_url(\n    image_url=image_url,\n    visual_features=[VisualFeatures.READ]\n)\n\nif result.read:\n    for block in result.read.blocks:\n        for line in block.lines:\n            print(f\"Line: {line.text}\")\n            print(f\"  Bounding polygon: {line.bounding_polygon}\")\n            \n            # Word-level details\n            for word in line.words:\n                print(f\"  Word: {word.text} (confidence: {word.confidence:.2f})\")\n```\n\n## People Detection\n\n```python\nresult = client.analyze_from_url(\n    image_url=image_url,\n    visual_features=[VisualFeatures.PEOPLE]\n)\n\nif result.people:\n    for person in result.people.list:\n        print(f\"Person detected:\")\n        print(f\"  Confidence: {person.confidence:.2f}\")\n        box = person.bounding_box\n        print(f\"  Bounding box: x={box.x}, y={box.y}, w={box.width}, h={box.height}\")\n```\n\n## Smart Cropping\n\n```python\nresult = client.analyze_from_url(\n    image_url=image_url,\n    visual_features=[VisualFeatures.SMART_CROPS],\n    smart_crops_aspect_ratios=[0.9, 1.33, 1.78]  # Portrait, 4:3, 16:9\n)\n\nif result.smart_crops:\n    for crop in result.smart_crops.list:\n        print(f\"Aspect ratio: {crop.aspect_ratio}\")\n        box = crop.bounding_box\n        print(f\"  Crop region: x={box.x}, y={box.y}, w={box.width}, h={box.height}\")\n```\n\n## Async Client\n\n```python\nfrom azure.ai.vision.imageanalysis.aio import ImageAnalysisClient\nfrom azure.identity.aio import DefaultAzureCredential\n\nasync def analyze_image():\n    async with ImageAnalysisClient(\n        endpoint=endpoint,\n        credential=DefaultAzureCredential()\n    ) as client:\n        result = await client.analyze_from_url(\n            image_url=image_url,\n            visual_features=[VisualFeatures.CAPTION]\n        )\n        print(result.caption.text)\n```\n\n## Visual Features\n\n| Feature | Description |\n|---------|-------------|\n| `CAPTION` | Single sentence describing the image |\n| `DENSE_CAPTIONS` | Captions for multiple regions |\n| `TAGS` | Content tags (objects, scenes, actions) |\n| `OBJECTS` | Object detection with bounding boxes |\n| `READ` | OCR text extraction |\n| `PEOPLE` | People detection with bounding boxes |\n| `SMART_CROPS` | Suggested crop regions for thumbnails |\n\n## Error Handling\n\n```python\nfrom azure.core.exceptions import HttpResponseError\n\ntry:\n    result = client.analyze_from_url(\n        image_url=image_url,\n        visual_features=[VisualFeatures.CAPTION]\n    )\nexcept HttpResponseError as e:\n    print(f\"Status code: {e.status_code}\")\n    print(f\"Reason: {e.reason}\")\n    print(f\"Message: {e.error.message}\")\n```\n\n## Image Requirements\n\n- Formats: JPEG, PNG, GIF, BMP, WEBP, ICO, TIFF, MPO\n- Max size: 20 MB\n- Dimensions: 50x50 to 16000x16000 pixels\n\n## Best Practices\n\n1. **Select only needed features** to optimize latency and cost\n2. **Use async client** for high-throughput scenarios\n3. **Handle HttpResponseError** for invalid images or auth issues\n4. **Enable gender_neutral_caption** for inclusive descriptions\n5. **Specify language** for localized captions\n6. **Use smart_crops_aspect_ratios** matching your thumbnail requirements\n7. **Cache results** when analyzing the same image multiple times\n\n## When to Use\nThis skill is applicable to execute the workflow or actions described in the overview.\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.\n","","imported","https:\u002F\u002Fgithub.com\u002Fsickn33\u002Fantigravity-awesome-skills","user_system_seed","SkillOPIC",true,177,955,"2026-05-16 13:05:35",{"id":8,"name":21,"slug":22,"icon":23,"description":24,"sort":25,"createdAt":26},"编程开发","coding","mdi-code-braces","代码生成、调试、审查，提升开发效率",2,"2026-05-16 12:53:40",{"id":7,"name":28,"slug":29,"icon":30,"description":31,"moduleId":8,"sort":32,"skillCount":33,"createdAt":26},"DevOps","devops","mdi-cog-outline","CI\u002FCD、容器化、部署运维",3,162,[35],{"id":36,"skillId":4,"version":37,"fileName":38,"fileSize":39,"filePath":40,"fileHash":41,"manifest":42,"createdAt":19},"8d633d7c-4b35-4ed5-8069-f179b1717bcd","1.0.0","azure-ai-vision-imageanalysis-py.zip",2351,"uploads\u002Fskills\u002Fd17309d3-49a1-4693-852c-2d1578335758\u002Fazure-ai-vision-imageanalysis-py.zip","9a5f297f6f1bde1fc96abfafb3051044aad0bae18a4659460a35da9b3c20c10b","[{\"path\":\"SKILL.md\",\"isDirectory\":false,\"size\":7016}]",{"code":44,"message":45,"data":46},200,"success",{"items":47,"stats":48,"page":51},[],{"averageRating":49,"totalRatings":49,"ratingCounts":50},0,[49,49,49,49,49],{"limit":52,"offset":49,"hasMore":53,"nextOffset":52,"ratedOnly":16},15,false]