995 Bonus: Images [1.5d]

Updated . Posted . Visible to the public.

We've already learned how to integrate user-provided images uploads to our application in 205 basic file uploads and image versions. In this bonus chapter, we want to dive deeper.
Common web apps often include static images like icons and application logos next to the dynamically created images versions of uploaded files. To serve all of those with limited bandwidth and high quality, images formats and compression strategies have to be carefully selected.

Learn

Image formats

  • Understand the difference between raster images (like .png, .jpg and .webp) and vector images (like .svg).
  • Understand why a print designer talks a lot about physical measurements like "cm" and "DPI" and why this rarely matters to us.
  • Understand how JPEG compression degrades the image quality every time you save the file.
  • Understand the strengths and weaknesses of the following file formats:
    • Rasterized formats: webp, png, jpg, gif
    • Vector format: svg
  • Read why we want to use WebP instead of PNGs and JPGs in the future

High density displays

Browse the internet in order to:

  • Understand the distinction between virtual pixels vs. physical pixels.
  • Understand how raster images prepared for a 1:1 pixel ratio look like on high density displays.
  • Understand which classes of devices typically have high-density displays (Smartphones, Macs) and which don't (most PCs, cheap phones, TVs).

Since we rarely know which device will be displaying our applications, we need to deal with both.

Browse the internet and get familiar with the following ways to embed raster images for high-density displays:

  • Always embed images in larger resolution
  • Use vector graphics
  • Create multiple sizes of the image
    • Use media queries that test for min-device-pixel-ratio
    • Use <img srcset="...">
    • Use <picture>
  • Ignore the issue

Discuss the pros and cons of each approach with your mentor.

Resources

Exercises

Add a logo image to MovieDB. The logo image should not look pixelated on both high- and low-density displays.

Menu icons

Add icons to the menu items of your MovieDB.

Integrate Feather Show archive.org snapshot for this. You might need such a compiler to "activate" the icons:

import feather from 'feather-icons'
up.compiler('[data-feather]', feather.replace)
Henning Koch
Last edit
Michael Leimstädtner
Keywords
retina
License
Source code in this card is licensed under the MIT License.
Posted by Henning Koch to makandra Curriculum (2015-09-09 06:38)