You can try this:
<img id="id1" src="url/to/file.png" onload="showImage()">
function showImage() {
$('#id1').attr('src', 'new/file/link.png');
}
Also, try to remove the ~
, that is just the operator, that is needed for Server-Side (for example ASP.NET) you don't need it in JS.
This way, you can change the attribute for the image.
Here is the fiddle: http://jsfiddle.net/afzaal_ahmad_zeeshan/8H4MC/