I have an icon defined like that:

speakerIcon = Graphics[{
    Triangle[{{0, -1}, {1,1},{-1,1}}],
    Rectangle[{-1, -1},{1, 0}]
}, ImageSize->20]

I can display that icon in an arbitrary color by wrapping it inside Show:

Show[Graphics[FaceForm[Pink]], speakerIcon]

But how to draw only the outline of the icon? Using EdgeForm does not work since it displays the outline of each component of the graphic object:

    speakerIcon, ImageSize->100

enter image description here

FWIW, I suspect I didn't follow the "right" path by defining my region as a Graphics. Maybe using Region would have been better? I'm open to any suggestions.


2 Answers 2


With Mathematica 12 a possible approach is OuterPolygon:

pol = Polygon[{{{0, -1}, {1, 1}, {-1, 1}}, {{-1, -1}, {1, -1}, {1, 
     0}, {-1, 0}}}]
Graphics[{FaceForm[], EdgeForm[{Thick, Blue}], pol}]

enter image description here

Graphics[{FaceForm[], EdgeForm[{Thick, Blue}], OuterPolygon[pol]}]  

enter image description here

  • $\begingroup$ Merci beaucoup André! I still have to try it, but I think I will follow that path (pun intended) because, as I explained in a comment to the @kglr's answer, I'm somewhat uncomfortable in constantly converting from graphics to regions and back. $\endgroup$ Commented Feb 24, 2020 at 11:55

You can use BoundaryDiscretizeGraphics:

bdg = BoundaryDiscretizeGraphics @ speakerIcon

enter image description here

Graphics[{EdgeForm[{Black, Thin}], FaceForm[], MeshPrimitives[bdg, 2]}, ImageSize -> 30]

enter image description here

Alternatively, you can use BoundaryDiscretizeRegion + RegionUnion:

bdr = BoundaryDiscretizeRegion[
  RegionUnion[Triangle[{{0, -1}, {1, 1}, {-1, 1}}], Rectangle[{-1, -1}, {1, 0}]]]

enter image description here

  • $\begingroup$ Thanks, @kglr. One side comment: when drawing shapes, I noticed I often have to convert between Graphics objects and Region, in one direction or the other. I read regions are a recent addition to Mathematica. Does that mean a rule of thumb would be to use them exclusively and considering Graphics only to render the output? On the other hand, it seems quite a waste of resources to convert even the simplest polygons to mesh objects. $\endgroup$ Commented Feb 24, 2020 at 11:51
  • 1
    $\begingroup$ @SylvainLeroux, TIL from andre's answer that it may not be necessary to go through Region for some shapes. $\endgroup$
    – kglr
    Commented Feb 24, 2020 at 17:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.