is an option for image highlighting that specifies what legends to use.
ImageLegends
is an option for image highlighting that specifies what legends to use.
Details
- Typical settings for ImageLegends include:
-
None add no legend Automatic use automatic legending "Expressions" use the expressions as legends {lbl1,lbl2,…} use lbli for the i
inputexpr use expr as the legend Placed[lspec,…] specify placement of the legend
Examples
open all close allBasic Examples (1)
Scope (3)
Specify custom legend placement:
HighlightImage[[image], {Red, Rectangle[{40, 10}, {178, 210}], Cyan, Rectangle[{200, 70}, {357, 184}]},
ImageLegends -> {Placed["plant", Left], Placed["books", Right]}]Use ImageLegends"Expressions" to use the input regions as legend labels:
HighlightImage[[image], {ImageBoundingBoxes[#1, Entity["Concept", "Cup::w4d7b"]]&, ImageBoundingBoxes[#1, Entity["Concept", "Book::t8bc6"]]&},
ImageLegends -> "Expressions"]HighlightImage[[image], {Red, Rectangle[{40, 10}, {178, 210}], Cyan, Rectangle[{200, 70}, {357, 184}]},
ImageLegends -> None]Applications (2)
Display a legend to distinguish between corner points and keypoints on an image:
HighlightImage[[image], {Red, (ImageCorners[#, MaxFeatures -> 50]&), Cyan, ImageKeypoints},
ImageLegends -> {"Corners", "Keypoints"}]Automatically display legends for the result of a semantic object detection function:
HighlightImage[[image], ImageBoundingBoxes,
ImageLegends -> Automatic, ImageLabels -> None, ImageSize -> 400
]Properties & Relations (3)
Displaying a legend sets the highlighting color based on the legend label:
i = [image];
HighlightImage[i, {Rectangle[{40, 10}, {178, 210}]},
ImageLegends -> "plant"]If a color has been explicitly specified, it is used instead:
HighlightImage[i, {Cyan, Rectangle[{40, 10}, {178, 210}]},
ImageLegends -> "plant"]The ImageLegends specification is displayed after any explicit use of Legended:
HighlightImage[[image], {Red, Rectangle[{40, 10}, {178, 210}], Cyan, Legended[Rectangle[{200, 70}, {357, 184}], "object"]},
ImageLegends -> {"plant", "books"}]Association keys can be used both as label and legend specification:
HighlightImage[[image], <|"plant" -> Rectangle[{40, 10}, {178, 210}], "books" -> Rectangle[{200, 70}, {357, 184}]|>,
ImageLabels -> Automatic, ImageLegends -> Automatic]Related Guides
History
Text
Wolfram Research (2020), ImageLegends, Wolfram Language function, https://reference.wolfram.com/language/ref/ImageLegends.html.
CMS
Wolfram Language. 2020. "ImageLegends." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/ImageLegends.html.
APA
Wolfram Language. (2020). ImageLegends. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/ImageLegends.html
BibTeX
@misc{reference.wolfram_2026_imagelegends, author="Wolfram Research", title="{ImageLegends}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/ImageLegends.html}", note=[Accessed: 12-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_imagelegends, organization={Wolfram Research}, title={ImageLegends}, year={2020}, url={https://reference.wolfram.com/language/ref/ImageLegends.html}, note=[Accessed: 12-June-2026]}