Iterates over the images inside the div and scales its id:
$("div img").each(function(i){
this.id = this.id + "_" + i;
});
Before
<div><img id='me'/><img id='me'/></div><img id='me' />
After:
<div><img id='me_0'/><img id='me_1'/></div><img id='me' />