I suggest using GIMP. It's free open-source software.
Use the magic wand tool to select the parts of the image you want to surround. Then Select > Grow, to add the width of the border (e.g., 4px). Then Select > Border (e.g., 4px), to create a border selection. Next, pick white as the color you want to use with the fill tool (the bucket) that you can fill with white.
On the bucket tool, you'll want "fill whole selection" and "FG color fill" selected. The put the cross-hairs of the bucket cursor inside the 4px border selection and left-click.
You might need to go into the image with the pencil tool to touch up any sharp angles with white, but it'll get the job done.