Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw border around nontransparent part of image on canvas

Tags:

I'm drawing an image onto a canvas using drawImage. It's a PNG that is surrounded by transparent pixels, like this:

isometric drawing of a patch of grass

How can I add a solid-colored border to the visible part of that image on the canvas? To clarify: I don't want a rectangle that surrounds the image's bounding box. The border should go around the grass patch.

I did consider using shadows, but I don't really want a glowing border, I want a solid one.