diff --git a/reviewboard/static/lib/js/retina.js b/reviewboard/static/lib/js/retina.js
index 4972d34772fe95406ae2bb3836c5bd4e7d65de69..e626c19cd35319d493a8e75328a096ea2dcac913 100644
--- a/reviewboard/static/lib/js/retina.js
+++ b/reviewboard/static/lib/js/retina.js
@@ -150,8 +150,8 @@
       if (! that.el.complete) {
         setTimeout(load, 5);
       } else {
-        that.el.setAttribute('width', that.el.offsetWidth);
-        that.el.setAttribute('height', that.el.offsetHeight);
+        that.el.setAttribute('width', that.el.naturalWidth || that.el.offsetWidth);
+        that.el.setAttribute('height', that.el.naturalHeight || that.el.offsetHeight);
         that.el.setAttribute('src', path);
       }
     }
