Image size: Total bits = pixels * bits/pixel
To improve performance:
- need to keep images as small as possible (less pixels) -AND-
- compression as HIGH as possible (bits/pixel)
- therefore, (less pixels) * (better compression) ==> LESS BYTES
For pictures:
- don't assume window-size === screen-size
- don't assume the window-size WON'T change
- max-width: 100% IS your friend
- CSS calc(..) can be used for resizing, margins, etc
- img: last-of-type {} ... to prevent settings on a last item (or image) in a list/set
New CSS width/height properties:
- vh, vw, vmin, vmax for setting images to a certain % of the height, widht
- vmin, vmax for setting images to AT MOST a certain % of either the height or width
- Did you notice how setting both the height and the width to 100vmax or 100vmin changes the image's aspect ratio? It'll compress your images to squares, so be careful if you want to maintain a different aspect ratio!
Raster vs Vector Images
- Raster typically pictures ... grids of dots to create image
- Vector can be resized ... geometry is described vs array of pixels
Image Placeholder Services:
Responsive Images - Tools
-
Imagemagick
- ImageMagick
- Simple ImageMagick installer for Mac
- [GraphicsMagick (a fork of ImageMagick)](http://www.graphicsmagick.org/" target="_blank)
-
Grunt
- Getting started with Grunt
- [Grunt for People Who Think Things Like Grunt are Weird and Hard] (http://24ways.org/2013/grunt-is-not-weird-and-hard/)
- Generate multi-resolution images with Grunt
- Grunt plugin for generating multiple images
-
Files used in scripting examples:
-
Image processing tools:
Image Optimization Tools:
- How to check if an image on your site has been optimized?
- PageSpeed insights tool
- Various PageSpeed Insights tools/plugins/etc:
Images with Markup:
- Reducing images used, or transferred for better performance
- Many existing, and great looking websites, use layout/typography rather than images for a great look
- CSS EFFECTS: Using CSS effects instead of images has many advantages (though some processing/rendering costs):
- UNICODE CHARS: If possible, use Unicode characters instead of images for graphics
- ICON FONTS: Icon Fonts are another efficient way to add images
- Inline SVG and DATA URI:
SRCSET - Setting up Responsive Images
* Images - Google Web Fundamentals
* Srcset and Sizes
* Phone Pixel Density List
* High DPI Images for Variable Pixel Densities
* Height Based selection
* The SRCSET attribute
* Using SRCSET
* Understanding Pixel Density, Resolution and Retina Displays
* Standard Image Sizes
* Responsive Images in Practice
The Picture Element
* WebP - new image format for web
* Art direction can be achieved fairly easily with the
Alt Attributes - important for situations/web-tools that don't display images * Lynx * Chromevox Screen Reader * General advice about alt attributes: * alt attributes should be descriptive for important images, like this body surfer. Because body surfing is important, I guess. * alt attributes should be empty for images that are just decorations, like this boiler image. Do you get the joke? It's a boiler to represent boiler plate code, which is sometimes empty of content. * alt attributes should be set on every image, just like this pig is set on being so darn cute. *