How to make your Websites Retina ready
Making your website ready for Retina displays doesn’t have to be a hassle. Whether you are building a new website or upgrade an existing one, this guide is designed to help you get the job done smoothly.

Make it Retina first
The easiest and most time-saving way to add retina support is to create one image that is optimized for retina devices and serve it to non-retina devices as well.
By now every modern browser uses bicubic resampling and does a great job with downsampling images. Here is a comparison of downsampling in Photoshop vs Google Chrome using an image from our Growth Engineering 101 website.

There are two ways to let the browser downsample images for you. Using img tags and using CSS background images.
If you have img tags serve the retina optimized image and set the width and height attributes to half of the resolution of the actual image (e.g. 400x300 if the image dimensions are 800x600).
<img src=”http://www.example.com/retina-image-800x600-2x.png” width=”400” height=”300”>
If you use images as CSS background you can use the background-size property of CSS3 to downsample the image for non-retina devices.
<div class=”photo”></div>
.photo {
background-image: url(retina-image-800x600-2x.png);
background-size: 400px 300px;
background-repeat: no-repeat;
display: block;
width: 400px;
height: 300px;
}
In both cases make sure to use even numbers in both dimensions to prevent displacement of pixels when the image is being downsampled by the browser.
When downsampling is not good enough
Usually browser downsampling should work very well. That said there are some situations where downsampling in the browser might make images blurry.
Here we have a bunch of 32x32 px social icons.

And here is how they look like downsampled to 16x16px by Photoshop’s as well as Google Chrome’s bicubic filter. It seems like we get better results from Photoshop in this case.


To get the best results for our users we can create two versions of the same image. One for retina devices and another one downsampled by photoshop for non-retina devices.
Now you can use a CSS media query to serve retina or non-retina images depending on the pixel density of the device.
/* CSS for devices with normal screens */
.icons {
background-image: url(icon-sprite.png);
background-repeat: no-repeat;
}
/* CSS for high-resolution devices */
@media only screen and (-Webkit-min-device-pixel-ratio: 1.5),
only screen and (-moz-min-device-pixel-ratio: 1.5),
only screen and (-o-min-device-pixel-ratio: 3/2),
only screen and (min-device-pixel-ratio: 1.5) {
.icons {
background-image: url(icon-sprite-2x.png);
background-size: 200px 100px;
background-repeat: no-repeat;
}
}
If you use a background color for small icons on the other hand, downsampling by the browser works pretty well. This is the same downsampling example with white background.

Polishing your Downsampled Images
If you’re still not satisfied with the results from Photoshop’s downsampling you can go the extra mile and hand-optimize the non-retina version to get super crisp results.
Below are some examples of images from the Blossom product website that I hand-optimized for people on non-retina devices.
Borders & Strokes
Here is an example of downsampling issues with hairlines where I re-draw the lines of the downsampled image.

View the Retina Version of this Image on Dribbble.


Text
Here is an example of downsampling issues with text. In this case I manually re-wrote the text “Feature Pipeline” to get to a crisp result.

Retina Version


When details, crisp fonts and clean hairlines are important you might want to go the extra mile.
Try to avoid Images
The main disadvantages of rasterized images are their big file size and that they don’t scale well to different sizes without affecting the image quality. Great alternatives to rasterized graphics are CSS, Scalable Vector Graphics (SVG) and Icon Fonts.
If you have any chance to build graphical elements of your website in CSS go for it. You can use it to add gradients, borders, rounded corners, shadows, arrows, rotate elements and much more.
Here are a few examples of interaction elements in Blossom that are implemented in CSS. The subtle gradient is powered by CSS gradients and the custom font in use on this button is Kievit served via Typekit. No images.

In the following screenshot the only two images used are the user avatar and the blue stamp. Everything else – the circled question mark, the dark grey arrow next to it, the popover, its shadow and the arrow on top of it are all pure HTML and CSS.

Here you can see how projects in Blossom look like. It’s a screenshot of a project’s website used as cover on a stack of paper sheets. The paper sheets are implemented with divs that are rotated using CSS.

Also the circled arrow in the righthand side of the screenshot below is pure CSS.

Here are some awesome tools that can help you to save time when you are creating effects using CSS.
CSS Generator:
Cross browser CSS3 syntax by @RandyJensen.
http://css3generator.com/
CSS Arrows:
CSS for tooltip arrows by @ShojBerg.
http://cssarrowplease.com/
Generating CSS for Sprites:
Sprite Cow helps you get the background-position, width and height of sprites within a spritesheet as a nice bit of copyable css. It’s built by TheTeam and it’s a real time saver and definitely worth giving a try.
http://www.spritecow.com/

The main advantage of SVG is that unlike rasterized graphics they scale reasonably well to various sizes. If you have simple shapes they usually are also way smaller than PNGs and are often used for things like charts.

Icon Fonts are often used as a replacement for image sprites. Similar to SVG they can be scaled up infinitely without any loss of quality and are usually smaller in size compared to image sprites. On top of that you can use CSS to change their size, color and even add effects like shadows.
Both SVG and Icon Fonts are well supported by modern browsers.
Retina ready Favicons
Favicons are really important for users who want to have an overview about which website belongs to which browser tab. A Retina ready Favicon will not only be easier to identify but also stand out among a crowd of Favicons that are not optimized for high resolution devices yet.
To make your Favicon Retina ready I can highly recommend X-Icon Editor. You can either upload a single image and let the editor resize it for different dimensions or you can upload separate images optimized for each size to get the best results.

How to make existing Images Retina ready
If you want to upgrade an website with existing images it is a bit more work as you need to re-create all images to make them Retina ready but this doesn’t need to be super hard.
First of all try to identify images that you can avoid by using alternatives like CSS, SVG and Image Fonts as mentioned previously. Buttons, Icons and other common UI widgets usually can be replaced with modern solutions that don’t require any images.
In case you actually need to re-create rasterized images you need to go back to your source files. As you might assume, simply resizing your rasterized bitmap images twice as big doesn’t get the job done because all the details and borders get pixelated.
But no need to despair – image compositions which mostly contain vectors i.e. in Adobe Photoshop or Illustrator are quite easy to scale up. That said don’t forget to check if your Photoshop effects in the blending options such as strokes, shadows and bevels still look as intended.
In general, making most Photoshop Compositions directly out of vectors (shapes) and Photoshop’s Smart Objects will save you a lot of time in the future.
How to optimize the File Size of Images
Last but not least optimizing the file size of all images in an application or website could effectively save up to 90% of image loading times. When it comes to retina images, the file size reduction gets even more important as they have a higher pixel density which also increases their file size.
In Photoshop you can optimize the image filesize via the “Save for Web” feature. On top of that there is an amazing free tool called ImageAlpha, which can reduce the filesize of your images even more with just a minor loss of quality.
Unlike with Photoshop you can use ImageApha to convert 24-bit alpha channel PNGs to 8-bit PNGs with alpha channel support. The icing on the cake is that these optimized images are cross-browser compatible and even work for IE6.
You can play around with different settings in ImageAlpha to get the right trade-off between quality and file-size. In the case below we can reduce the file size by almost 80%.

When you are done setting your desired compression levels ImageAlpha’s save dialog also offers you to “Optimize with ImageOptim” - another awesome free tool.
ImageOptim automatically picks the best compression options for your image and removes unnecessary meta information and color profiles. In the case of our stamp file ImageOptim was able to reduce our file size by another 34%.

After we’ve updated all assets of Blossom for high resolution displays and used ImageAlpha & ImageOptim to optimize the file size we actually ended up saving a few kb in comparison to the assets we had before.
Save Time, read this Book
Awesome Retina Ready Sites on the Web
http://www.layervault.com
http://www.apple.com
http://www.panic.com/









