I read a simple way to display an image on a webpage
without scaling when viewed on a retina device
is to simply half it's actual dimensions in the <img> tag.
Made a quick test can be viewed here:
Simple Retina Display Test
The original png image is 404x298,
within it's border are alternating black and white pixels.
Displayed without scaling it should look smooth. No circles within.
On the test webpage it's first displayed using its full dimensions :
Then its displayed using half sizes:
The half size tagged image displays correctly with Safari on a retina MacBook Pro,
but not on the retina iPad where scaling artifacts are seen?
Any simple fix?
Here's the full code:
without scaling when viewed on a retina device
is to simply half it's actual dimensions in the <img> tag.
Made a quick test can be viewed here:
Simple Retina Display Test
The original png image is 404x298,
within it's border are alternating black and white pixels.
Displayed without scaling it should look smooth. No circles within.
On the test webpage it's first displayed using its full dimensions :
Code:
<img src="images/RetinaTest.png" alt="Actual" height="298" width="404">
Then its displayed using half sizes:
Code:
<img src="images/RetinaTest.png" alt="Half" height="149" width="202">
The half size tagged image displays correctly with Safari on a retina MacBook Pro,
but not on the retina iPad where scaling artifacts are seen?
Any simple fix?
Here's the full code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<title>Retina Code Test</title>
</head>
<body style="margin: 30px;">
<p style="font-size:20px">
<br>
RETINA IMAGE DISPLAY TEST<br>
<br><br>
PNG Tagged with actual 404x298 dimensions
<br>
<img src="images/RetinaTest.png" alt="Actual" height="298" width="404">
<br>
<br>
PNG Tagged with half of actual 404x298 dimensions<br>
If image is rendering correctly on a retina iPad it should be clean, no dots.
<br>
<img src="images/RetinaTest.png" alt="Half" height="149" width="202">
<br>
<br>
</p>
</body>
</html>
Last edited: