Sourcecode Comment Current Safari
<img src="dpi_2x.png" width="50" height="50">
High Res image scaled down to half size
<img src="dpi.png" hidpi="dpi_2x.png" tridpi="dpi_3x.png" width="50" height="50">
$(document).ready(function(){
	if(window.devicePixelRatio>=2){
		$('img[hidpi]').each(function(){
$(this).attr('src',$(this).attr('hidpi'));	
		});
	}
});
Jquery replacement
<div id="cssback" style="width:50px;height50px;background:url(dpi.png);">DIV</div>
@media only screen and (-webkit-min-device-pixel-ratio: 2) {
  #cssback {
    background-image:url(dpi_2x.png) !important;
    -webkit-background-size: 50px 50px;
    -moz-background-size: 50px 50px;
    background-size: 50px 50px; 
    /* Size must be defined after background-image ! */
  }
}
CSS Media query
DIV
 
 
document.write(window.devicePixelRatio);
        
Javascript parameter 1: normal
2: Retina

dpi.png 50x50
dpi_1.5x.png 75x75
dpi_2x.png 100x100
dpi_3x.png 150x150