The AnnotatedImage component displays a base image with colored annotations overlaid, useful for object detection and segmentation visualizations.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/gradio-app/gradio/llms.txt
Use this file to discover all available pages before exploring further.
Basic usage
Constructor
Tuple of (base_image, annotations) where:
base_imageis filepath, PIL Image, or numpy array- Each annotation is
(mask, label)tuple maskcan be:- Tuple of 4 ints
(x1, y1, x2, y2)for bounding box - Numpy array for segmentation mask (0-1 confidence values)
- Tuple of 4 ints
Image format for saving (e.g., “png”, “jpg”)
Whether to display legend of annotations
Component height
Component width
Dictionary mapping labels to hex colors (e.g.,
{"cat": "#FF0000"})Events
- select - Triggered when annotation is selected