24
1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

Embed Size (px)

Citation preview

Page 1: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

1

MMDE5012Interactive Media Practice Seminar 2

Week 2

Page 2: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

2

Class Website / bloghttp://www.saimaali.com/teaching/MMDE5012

Page 3: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

3

Retina Graphics

Page 4: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

4

What is Retina?• “High DPI” and “Retina” displays are currently changing the nature

of the web. • Before telling you how to develop images for these new devices, it

makes sense to understand the basics of the technology: what is high DPI, and why is it significant?

• Very simply, “high DPI” and “Retina” mean the same thing: a device with a high pixel density.

• “Pixel density” is the number of pixels a display can fit into a fixed distance.

• This is different from “resolution”, which is a simple count of the number of pixels across the entire width and height of a device.

4

Page 5: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

5

What is Retina?•We have Retina capable iPhones, iPods, iPads and MacBooks.

•The iPhone 3GS (non-Retina) features a display resolution of 153,600 pixels.

•The iPhone 4 features a display resolution of 614,400 pixels.

Page 6: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

6

Pixel Density• For example, the resolution of an iPhone 4 to an old VGA desktop

monitor, the monitor will have a similar resolution, but a much larger physical size, and thus a significantly lower pixel density.

• If we divide the physical width of the display (in inchs) by the number of pixels displayed horizontally, the result is the number of pixels per inch (ppi, also commonly referred to asdpi).

• Most current desktop monitors display around 96 to 110 DPI, with laptops coming in slightly higher.

• “High DPI” is generally acknowledged to be any device with a display density of 200 pixels per inch or greater.

6

Page 7: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

7

DPI• Traditional development practices have optimized web-ready

graphics at the common denominator of 72 DPI. • A “high DPI” device displaying such an image must double or even

quadruple the number of pixels in the graphic to provide the impression that it is roughly the same size on a Retina display.

• Due to this interpolation – a fancy name for guesswork – the image quality suffers.

• Once you understand the concept pixel density, the issue is how to optimize your images for the new displays.

7

Page 8: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

8

Resolution Independence (RI)•Another concept to understand is Resolution Independence.

•Interfaces that can scale are said to have Resolution Independence.

•It means having resources that will look great at different sizes.

Page 9: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

9

The Retina Concept•What it is not:

• Images saved at a higher resolution (PPI / DPI).• iOS ignores the PPI (pixels per inch) information stored

inside images.

•What it is:• Images saved at twice the size (2x).• E.g. a 100x100 px image would become 200x200 px.• The supersized (2x) images are then displayed in the

original image size dimensions.• This creates a smooth and crisp appearance on high pixel

density (Retina) screens.

Page 10: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

10

What is Retina?•iOS resolutions

• 640 x 960 (iPhone and iPod Touch)• 1536 x 2048 / 2048 x 1536 (iPad)

•App icons• iPhone: 57 x 57• Retina iPhone: 114 x 114• iPad: 72 x 72• Retina iPad: 144 x 144

Page 11: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

11

Page 12: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

12

Page 13: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

13

Designing Retina Graphics•Bitmaps are your enemy.•If you do need to work with bitmap images (eg jpegs etc), the most important point in this new web development process is – always retain the very highest resolution version of your images.

•The Best way to design graphics / icons / logos for different scales is in an EPS or AI format.

Page 14: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

14

Vectors•These formats use vector graphics.•Vector graphics use of geometrical features such as points, lines, curves, and shapes or polygon(s), which are all based on mathematical expressions.

•This makes them ‘scalable’ without any loss of quality.

•You can also use Photoshop’s vector features eg the Shape tool.

•Complex vector objects can be drawn in Illustrator to the exact pixel size, then pasted into Photoshop as a Shape layer.

14

Page 15: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

15

Designing Retina Graphics•What if you already have a website and you want to add Retina support?• You have to go back and rebuild every image!

•Scaling up an image would result in a fuzzy appearance with lots of anti-aliased lines.

•Use Photoshop’s Image Size option called Nearest Neighbor.• Not as good as rebuilding the element.

Page 16: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

16

Page 17: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

17

Page 18: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

18

Designing Retina Graphics•What about designing at 200% (2x) and scaling down?

•Scaling down an image in Photoshop would result in a fuzzy appearance, especially when it comes to icons.

•This is why everything should be built as vector objects with layer styles and other generated effects.

Page 19: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

19

Coding Retina Graphics•Save everything in the same ‘images’ folder.

•Filename will have an additional @2x at the end.• E.g. chart.jpg will become [email protected]

•Two methods:• HTML/CSS way• Retina.JS

Page 20: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

20

Coding Retina Graphics•HTML/CSS way

• Generate two versions of each image.• Background images specified in your CSS can be swapped out

using media queries.

@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)

{header h1 a {

background-image: url(images/[email protected]);

background-size: 164px 148px;}

}

Page 21: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

21

Coding Retina Graphics•HTML/CSS way

• For inline images, you will need to modify the <img> tag

• <img src="images/[email protected]" width="300px" height="150px" />

You can use JavaScript:

• if (window.devicePixelRatio == 2) {

//Replace your img src with the new retina image }

Page 22: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

22

Coding Retina Graphics•Retina.JS

• Add

<script src=”js/retina.js”></script>

to the head section of your HTML file.

• Checks for @2x images in your images directory and automatically swaps them out for you.

Page 24: 1 MMDE5012 Interactive Media Practice Seminar 2 Week 2

24

Retina Exercises• Exercise 1: • Use media queries to swap in high density graphics when

the display has a pixel ratio higher than 2.

• Exercise 2:• Use the retina.js script to automatically check for retina

images (@2x) and swap them.

24