<script type=“text/javascript”>

(function () {
  var resize = function () {
    this.width = 0.5 * (this.naturalWidth || this.width);
  }
  Array.prototype.forEach.call(document.querySelectorAll(".half-size, .retina2x"), function(el) {
    if (el.naturalWidth) {
      resize.call(el);
    } else {
      el.onload = resize;
    }
  });
})();

</script>