It's not in a web part, it is in an MVC page type that we set up. The page type has custom fields, one of them being the Content field holding the data in my initial post. Its data type is "Long Text" and the form control is "Rich text editor". The code is being parsed like this in our MVC view:
Within the rich text editor, the user is embedding images. In the source of the rich text editor, there is no ~ sign:
<img alt="my_image.jpg" src="/getattachment/9e73aea8-8a8f-497f-8b25-4f233a6cb719/my_image.jpg" style="width: 239px; height: 241px;" title="my_image.jpg" />
The output filter is set up just as the image you linked.