<p><img src""></p>
<p><img src""></p>
<p>текст<p><img src"">
<img src"">
<p>текст<p>
$("p").each(function(i, el) {
if (el.children.length == 1 && el.children[0].nodeName == "IMG") {
$(el).after(el.children[0]);
$(el).remove();
}
});