Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatic Retina images for web sites

With the new Apple MacBook Pro with retina display, if you provide a "standard" image on your website, it'll be a little fuzzy. So you have to provide a retina image.

Is there a way to automatically switch to @2x images, like iOS (with Objective-C) does? What I've found is: CSS for high-resolution images on mobile and retina displays, but I wish I could find an automatic process for all my images, without CSS or JavaScript.

Is it possible?

UPDATE
I would emphasize this interesting article suggested by @Paul D. Waite and an interesting discussion about it linked by Sebastian.

like image 926
jacoz Avatar asked Dec 06 '12 13:12

jacoz


People also ask

How do I create a retina image for my website?

To make your website retina-ready, use Scalable Vector Graphics (SVG) whenever possible. SVG is an XML-based graphic format that presents images in high quality. SVG images can be viewed in Internet browsers that use XML or be displayed on mobile phones in SVGB or SVGT file formats.

What is retina images in HTML?

While 'Retina display' is an Apple brand name, the term 'retina' is often used to describe high-DPI displays from other manufacturers. Likewise, retina is commonly used to refer to images optimized for high-DPI displays, which you'll learn about below.

What is retina ready website?

Retina-ready websites are websites that utilise modern technology to display high-resolution images on devices that have high definition (HD) displays, such as the many tablets and smartphones, and some modern laptops, macbooks and desktop PCs.


1 Answers

There is a new attribute for the img tag that allows you to add a retina src attribute, namely srcset. No javascript or CSS needed, no double loading of images.

<img src="low-res.jpg" srcset="high-res.jpg 2x">

Browser Support: http://caniuse.com/#search=srcset

Other Resources:

  • WebKit release post
  • W3C documentation for srcset
  • good explanation about why and how to use srcset
  • Chris Coyer's post for more good info
like image 66
ebuat3989 Avatar answered Sep 28 '22 08:09

ebuat3989